XBMC will be renamed to Kodi for v14. Read here for more details
Various pages on the wiki might contain old references to "XBMC", but will most often still apply to "Kodi". Find out how you can help here.

Archive:HOW-TO:Install XBMC on Ubuntu/HOW-TO 1, MythSExx

From Kodi
(Difference between pages)
Jump to: navigation, search
m (Autoboot to XBMC)
 
 
Line 1: Line 1:
The purpose of this guide is to give a hand to new XBMC users, who want to build a Linux based, dedicated [http://en.wikipedia.org/wiki/Home_theater_PC HTPC (Home Theater PC)], a true living-room media center computer, but don't have any knowledge and experience in the Linux world.
+
This page is under construction
  
You always have the chance to try [[XBMC Live]] to test/demo XBMC Media Center, but if you want to have more control and more customization possibilities, than a Linux installation like in this guide is more suitable.
+
----
  
= Introduction =
+
MythSExx allows you to export your dynamic MythTV library into XBMC.  
This is a real step-by-step guide, I hope everybody can follow and walk through the whole installation procedure. The guide is based on either Ubuntu 8.04 (Hardy Heron) or 8.10 (Intrepid Ibex) as a platform, start with a minimal install and only install the needed components at the top of that.
+
  
On the face of it, maybe seems very lengthy process, but you will feel shorter while you follow it.
 
  
'''Please note:'''
+
Key features:
* The guide is for using XBMC on a dedicated HTPC, so there is no window manager and/ or any additional applications installed.
+
*MythTV recordings renamed to Show name.SxxExx (episode title).ext
* You need minimum 4GB size Flash drive or harddisk drive to install on.
+
*Symlinks allow MythTV to maintain your library.  Symlink from new file in place of old.  Symlink to original.
* Since you will use this PC only as a [http://en.wikipedia.org/wiki/Media_center media center]. I therefor assume that you use digital audio pass-through (S/PDIF or HDMI) to a receiver/amplifier with built-in Dolby Digital (AC3) decoder, and hence I choose NOT to install the dependency libraries for PulseAudio and compile XBMC later without PulseAudio support.
+
*TvDb recognition of Show Name and Episode Name
 +
*Fuzzy logic episode name matching allows for improperly named episodes
 +
*User defined show name translations for improper guide data
 +
*User is notified at the end of each operation
 +
*Dynamic mount support with alternate move dir
 +
*Failsafe Symlink mode
 +
*easy to troubleshoot permission errors and other problems in debug mode
 +
*Can be run as MythTV job.
 +
/home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
  
'''You will get:'''
+
in progress:
* A dedicated HTPC which auto-boots directly to XBMC Media Center.
+
*multiple shows in single recordings (currently handled by clipping second name)
* Latest XBMC SVN version.
+
* Updated ALSA (audio) driver.
+
* Updated VIDEO (graphics) driver.
+
* LIRC (Microsoft MCE Remote will work out-of-the-box, however if you have any other remotes and/or LCD displays then you are on your own to solve the individual LIRC and LCDproc issues).
+
* Suspend/resume (works perfectly on for example ASUS P5N7A-VM motherboard with Intrepid).
+
  
'''Known issues:'''
+
== MythSExx ==
* Installations based on Intrepid having some performance issues, due to unidetified reason. You can read more on that [http://forum.xbmc.org/showthread.php?t=43075 here].
+
* You might have some difficulties with suspend/ resume on Hardy based installation
+
  
= Preparation =
 
'''FIRST STEP'''<BR>
 
  
Download and burn Ubuntu Hardy or Intrepid mini.iso (according to your platform preference) from here:
 
<BR>https://help.ubuntu.com/community/Installation/MinimalCD
 
  
<span style="color:red">Please be aware, if you are installing a full Ubuntu system with GDM, then the guide will not fully work!</span>
+
*Create the following file
 +
Filename: /home/mythtv/MythSExx/MythSExx.sh
 +
#!/bin/bash
 +
 +
#MythSExx by Adam Outler
 +
#email: outleradam@hotmail.com
 +
#Software the way it should be: Free and Open Source
 +
#Please contact me with any bug reports
 +
 +
#Intention:
 +
# This program was designed to be a user job in MythTV.  It can be called by creating a user job.
 +
# The user job can be called as follows:
 +
# /home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
 +
#
 +
#Usage:
 +
#  MythSExx.sh -v "show name" "episode name" "Target Folder"
 +
#  eg. MythSExx.sh "South Park" "Here Comes the Neighborhood" "/home/mythrecordings/2308320472023429837.mpg"
 +
 +
#Output:
 +
# If an error occurs and the file cannot be moved, then no change will occur to the original file. If the Movedir
 +
# is full or not available, such as when running a NAS and the computer is disconnected from the network, the
 +
# AlternateMoveDir will be used. If both of these dirs fail, the show will be SymLinked in the FailSafeDir.
 +
# You may elect to run the user job at a later time when the issue has been resolved.  Output dir will depend
 +
# on user settings. The file name however, is preset to the most acceptable standard:
 +
#  Show Title - SxxExx (Episode Title).ext
 +
#
 +
#Symlinking:
 +
# When Symlinking is enabled, MythSExx will follow it's normal mode of operation.  In MOVE mode, MythSExx will
 +
# Create a symlink from the new file in the same name and location of the old file.  In LINK mode, MythSExx will
 +
# not move the file, LINK mode creates a new symlink to the original file.
 +
#
 +
#Logging:
 +
# Log file will show information for troubleshooting. You can find the log file in the working folder
 +
# Log file default location: /home/$username/MythSExx
 +
#
 +
#Dependencies: depends on "Curl" and "agrep" and "libnotify-bin"
 +
# install curl with "apt-get install curl" 
 +
# install agrep with "apt-get install agrep"
 +
# optional: install libnotify-bin with "apt-get install libnotify-bin"
 +
#
 +
#Show Name Translation
 +
# The user may elect to create a file in the MythSExx/ working folder which will then translate any recorded
 +
# show name into the desired show name.  This is useful for adding a year to distinguish between a new series
 +
# and an older series and/or typos in your guide data.  By default it should be called "showtranslations" and
 +
# by default it will be in your home/username/MythSExx folder.  showtranslations is not needed by most users
 +
# and the file should only be created if it is needed. Under most circumstances, the integrated fuzzy logic
 +
# will be sufficient to translate the guide name to the TvDb name, however showtranslations is available to
 +
# improve accuracy to 100%. The format of showtranslations is as follows:
 +
#Filename: /$MythSExx/showtranslations
 +
##############################################################
 +
#My Guide Show Title = www.TheTvDb.com Show Title            #
 +
#Battlestar Gallactica = Battlestar Gallactica (2003)        #
 +
#Millionaire = Who Wants To Be A Millionaire                #
 +
#Aqua teen Hungerforce = Aqua Teen Hunger Force              #
 +
##############################################################
 +
 +
 +
#######################USER SETTINGS##########################
 +
#MoveDir is the folder which MythSExx will move the file.  No trailing / is accepted eg. "~/videos"
 +
MoveDir="/home/mythtv/NAS/Video/shows"
 +
#AlternateMoveDir will act as a seccondary MoveDir if the primary MoveDir fails.
 +
AlternateMoveDir="/home/mythtv/Shared"
 +
#Disable moving of files.  If UseOriginalDir is Enabled, original dir will override MoveDir.  This can be useful for multiple recording dirs  Enabled|Disabled
 +
UseOriginalDir=Disabled
 +
#When Enabled, MythSExx will move the file to a folder of the same name as the show. This is not affected by UseOriginalDir. Enabled|Disabled
 +
UseShowNameAsDir=Enabled
 +
#SYMLINK has 3 modes.  MOVE|LINK|Disabled
 +
#Create symlink in original dir from file after MOVE, Create symlink in MoveDir LINK original(overrides moving), Simlinking Disabled
 +
SYMLINK=MOVE
 +
#Internet access Timeout in seconds: Default Timeout=50
 +
Timeout=50
 +
#MythSExx working file dir: Default is "~/MythSExx"
 +
MythSExx=~/MythSExx
 +
#FailSafe mode will enable symlinks to be formed in FailSafeDir if the move or symlink operation fails.
 +
FailSafeMode=Enabled
 +
#FailSafeDir is used when the file cannot be moved to the MoveDir. FailSafe will not create folders.
 +
FailSafeDir=~
 +
#The following line tells MythSExx to send a notification upon completion. Enabled|Disabled
 +
Notify=Enabled
 +
#If notifications are enabled, NotifyUserName should be the same as the user logged into the GNOME Session.
 +
NotifyUserName="adam"
 +
#the following line contains the API key from www.TheTvDb.Com. Default: 6DF511BB2A64E0E9
 +
APIkey="6DF511BB2A64E0E9"
 +
#Enables debug mode.  This is a verbose mode of logging which should be used for troubleshooting.  Enabled|Disabled
 +
DEBUGMODE=Enabled
 +
#########################USER SETTINGS##########################
 +
 +
###############################################################
 +
################Do not modify below this line##################
 +
###############################################################
 +
echo "@@@@@@@@@@NEW SEARCH INITIATED AT `date`@@@@@@@@@@@@@">>$MythSExx/output.log
 +
 +
#####DEFINE ENVIRONMENT AND VARIABLES#####
 +
#make our working dir if it does not exist
 +
if [ ! -d "$MythSExx" ]; then
 +
mkdir $MythSExx
 +
echo "creating home/MythSExx and log file">>$MythSExx/output.log
 +
fi
 +
 +
#Set episode name, dir, extension, and showname from the input parameters.
 +
ShowName=$1
 +
epn=`echo $2|sed 's/;.*//'|tr -d [:punct:]`
 +
originalext=`echo "${3#*.}"`
 +
originaldirname=`dirname "$3"`
 +
 +
#Check for show translations relating to the show in question.
 +
if [ -f $MythSExx/showtranslations ]; then
 +
showtranslation=`grep "$ShowName = " "$MythSExx/showtranslations"|replace "$ShowName = " ""|replace "$MythSExx/showtranslations" ""`
 +
if [ "$showtranslation" != "$null" ];then
 +
ShowName=$showtranslation
 +
echo "USER TRANSLATION: $ShowName = $ShowNametranslation">>$MythSExx/output.log
 +
elif [ "$showtranslation" = "$null" ];then
 +
$showtranslation = "Inactive"
 +
fi
 +
fi
 +
 +
if [ $UseOriginalDir = "Enabled" ]; then
 +
MoveDir=`echo "$originaldirname"`
 +
fi
 +
 +
#####SEARCH FOR SHOW NAME#####
 +
echo "SEARCHING: www.TheTvDb.com SHOW NAME: $ShowName EPISODE: $epn">>$MythSExx/output.log
 +
echo "FILE NAME: $3">>$MythSExx/output.log
 +
#download series info for show, parse into temporary text db- sid.txt shn.txt
 +
tvdbshowname=`echo $ShowName|replace " " "%20"`
 +
 +
curl -s -m"$Timeout" www.thetvdb.com/api/GetSeries.php?seriesname=$tvdbshowname>$MythSExx/working.xml
 +
cat $MythSExx/working.xml | grep "<seriesid>"|replace "<seriesid>" ""|replace "</seriesid>" "">$MythSExx/sid.txt
 +
cat $MythSExx/working.xml | grep "<SeriesName>"|replace "<SeriesName>" ""|replace "</SeriesName>" "">$MythSExx/shn.txt
 +
 +
#Use fuzzy logic to make the best match of the show name
 +
serieslinenumber=`agrep -Byn "${showname:0:29}" $MythSExx/shn.txt|sed 's/:.*//'|grep -m1 ^`
 +
 +
#Get the seriesid based on the showname
 +
seriesid=`sed -n $serieslinenumber'p' $MythSExx/sid.txt|grep -m1 ^`
 +
NewShowName=`sed -n $serieslinenumber'p' $MythSExx/shn.txt|grep -m1 ^`
 +
 +
#Create folder for database if it does not exist
 +
if [ ! -d "$MythSExx/$NewShowName" ]; then
 +
mkdir $MythSExx/"$NewShowName"
 +
echo "creating home MythSExx and log file">>MythSExx/output.log
 +
fi
 +
echo "SEARCH FOUND:""$NewShowName" "ID#:" $seriesid >>/$MythSExx/output.log
 +
 +
#If series ID is obtained, then get show information.
 +
if [ "$seriesid" != "" ]; then
 +
 +
#####GET SHOW INFORMATION#####
 +
#Strip XML tags
 +
seriesid=`echo $seriesid|tr -d "<seriesid>"|tr -d "</seriesid>"`
 +
 +
#download series info for series id
 +
curl -s -m"$Timeout" "http://www.thetvdb.com/api/$APIkey/series/$seriesid/all/en.xml">$MythSExx"/$NewShowName/$NewShowName.xml"
 +
 +
#create a folder/file "database" Strip XML tags.  Series, Exx and Sxx are separated into different files
 +
if [ -f "$MythSExx/$NewShowName/$NewShowName.xml" ]; then
 +
cat "$MythSExx/$NewShowName/$NewShowName.xml" | grep "<EpisodeName>"|replace "  <EpisodeName>" ""|replace "</EpisodeName>" ""|replace "/" "">$MythSExx/"$NewShowName"/"$NewShowName".Ename.txt
 +
cat $MythSExx/"$NewShowName"/"$NewShowName".xml | grep "<SeasonNumber>"|replace "<SeasonNumber>" ""|replace "</SeasonNumber>" ""|replace " " "">$MythSExx/"$NewShowName"/"$NewShowName".S.txt
 +
cat $MythSExx/"$NewShowName"/"$NewShowName".xml | grep "<EpisodeNumber>"|replace "<EpisodeNumber>" ""|replace "</EpisodeNumber>" ""|replace " " "">$MythSExx/"$NewShowName"/"$NewShowName".E.txt
 +
elif [ ! -f "$MythSExx/$NewShowName/$NewShowName.xml" ]; then
 +
echo "***FAILURE: curl -s -m$Timeout http://www.thetvdb.com/api/$APIkey/series/$seriesid/all/en.xml">>$MythSExx/output.log
 +
fi
 +
 +
#check if files were created and generate message
 +
if [ -f $MythSExx/"$NewShowName"/"$NewShowName".Ename.txt ]; then
 +
echo "LOCAL DATABASE UPDATED:$MythSExx/$NewShowName"
 +
elif [ ! -f "$MythSExx/$NewShowName/$NewShowName.Ename.txt" ]; then
 +
echo "*** PERMISSION ERROR $MythSExx/$NewShowName/">>$MythSExx/output.log
 +
fi
 +
 +
 +
#####PROCESS SHOW INFORMATION#####
 +
#grep use fuzzy logic to find the closest show name from the locally created database and return absolute episode number
 +
absolouteEpisodeNumber=`agrep -Byn "${epn:0:29}" "$MythSExx""/""$NewShowName""/""$NewShowName"".Ename.txt"|grep -m1 ^|sed 's/:.*//'`
 +
echo DEFINED ABSOLOUTE EPISODE NUMBER: $absolouteEpisodeNumber>>$MythSExx/output.log
 +
 +
#if line match is obtained, then gather Sxx and Exx
 +
if [ "$absolouteEpisodeNumber" !=  ""  ]; then
 +
epn=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".Ename.txt|sed 's/;.*//'`
 +
echo "Found Match: $epn $absolouteEpisodeNumber"
 +
#gather series and episode names from files created earlier.
 +
exx=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".E.txt`
 +
sxx=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".S.txt`
 +
 +
# Single digit episode and show names are not allowed Ex and Sx replaced with Exx Sxx
 +
if [ "$exx" -lt 10 ]; then
 +
exx=`echo E0$exx`
 +
elif [ "$exx" -gt 9 ]; then
 +
exx=`echo E$exx`
 +
fi
 +
if [ "$sxx" -lt 10 ]; then
 +
sxx=`echo S0$sxx`
 +
elif [ "$sxx" -gt 9 ]; then
 +
sxx=`echo S$sxx`
 +
fi
 +
fi
 +
 +
#if1 exit point
 +
elif [ "$seriesid" == "" ]; then
 +
  echo "series was not found the tvdb may be down try renaming $1">>$MythSExx/output.log
 +
fi
 +
#####OUTPUT#####
 +
if [ $DEBUGMODE = "Enabled" ]; then
 +
echo "#########################################################">>$MythSExx/output.log
 +
echo "###################DEBUG MODE ENABLED####################">>$MythSExx/output.log
 +
echo "#########################################################">>$MythSExx/output.log
 +
echo "LISTING INTERNAL VARIABLES USED BY MythSExx. VERIFY THESE ARE NOT EFFECTED BY GLOBAL VARIABLES">>$MythSExx/output.log
 +
echo "INTERNET TIMEOUT:$Timeout- TvDb API KEY:$APIkey- MythSExx WORKING DIR:$MythSExx-">>$MythSExx/output.log
 +
echo "MOVE DIR:$MoveDir- USING SHOWNAME AS FOLDER:UseShowNameAsDir-">>$MythSExx/output.log
 +
echo "FAILSAFE MODE:$FailSafe- FAILSAFE DIR:$FailSafeDir- ALTERNATE MOVE DIR:$AlternateMoveDir-"
 +
echo "USE ORIGINAL DIR:$UseOriginalDir NOTIFICATIONS:$Notify DEBUG MODE:$DEBUGMODE-">>$MythSExx/output.log
 +
echo "INPUT SHOW NAME:$1- LOCAL SHOW NAME TRANSLATION:$showtranslation- SENT TVDB SHOW NAME:$tvdbshowname-">>$MythSExx/output.log
 +
echo "RESOLVED SERIES ID:$seriesid- RESOVED SHOW NAME:$ShowName-">>$MythSExx/output.log
 +
echo "INPUT EPISODE NAME:$2- ABSOLOUTE EPISODE NUMBER:$absolouteEpisodeNumber- RESOLVED EPISODE NAME:$epn-">>$MythSExx/output.log
 +
echo "SEASON:$sxx- EPISODE:$exx-">>$MythSExx/output.log
 +
echo "##############LISTING FOLDER PERMISSIONS#################">>$MythSExx/output.log
 +
echo "ORIGIONAL FILE>ls -l $3">>$MythSExx/output.log
 +
ls -l "$3">>$MythSExx/output.log
 +
echo "MythSExx WORKING DIR>lsmod -l $MythSExx/$NewShowName/">>$MythSExx/output.log
 +
ls -l "$MythSExx/$NewShowName/">>$MythSExx/output.log
 +
echo "MOVE DIR>lsmod -l $MoveDir/">>$MythSExx/output.log
 +
ls -l $MoveDir>>$MythSExx/output.log
 +
echo "ALTERNATE MOVE DIR> ls -l $AlternateMoveDir">>$MythSExx/output.log
 +
ls -l "$AlternateMoveDir/">>$MythSExx/output.log
 +
echo "#########################################################">>$MythSExx/output.log
 +
echo "####################END OF DEBUG LOG#####################">>$MythSExx/output.log
 +
echo "#########################################################">>$MythSExx/output.log
 +
fi
 +
 +
 +
#output format  showname=show name sxx=season number exx=episode number epn=episode name
 +
ShowFileName=`echo "$NewShowName.$sxx$exx ($epn)"`
 +
 +
#check to see if episode information was obtained
 +
if [ "$exx" != "" ]; then
 +
#check to see if output folder exists
 +
if [ -d $MoveDir ]; then
 +
echo RESOLVED EPISODE INFORMATION: "$NewShowName: $epn = $sxx$exx">>$MythSExx/output.log
 +
#If specified, make $movedir = $movedir/show name
 +
if [ "$UseShowNameAsDir" = "Enabled" ]; then
 +
MoveDir=`echo "$MoveDir"/"$NewShowName"`
 +
#Make the folder if it does not exist
 +
if [ -d "$MoveDir" ]; then
 +
echo "VERIFIED FOLDER: $MoveDir">>$MythSExx/output.log
 +
elif [ ! -d "$MoveDir" ]; then
 +
echo "CREATING FOLDER: $MoveDir">>$MythSExx/output.log
 +
mkdir "$MoveDir"
 +
#Error message if folder was not created
 +
if [ ! -d "$MoveDir" ];then
 +
echo "******PERMISSION ERROR COULD NOT CREATE $MoveDir/$NewShowName">>$MythSExx/output.log
 +
fi
 +
fi
 +
fi
 +
fi
 +
 +
#If file to be moved does not exist, then explain why
 +
if [ ! -f "$3" ]; then
 +
echo "****** INPUT FILE NAME NON EXISTANT CHECK INPUT FORMAT">>$MythSExx/output.log
 +
fi
 +
 +
#If File exists, loop and add -$MythSExxCounter to the end of the file name
 +
if [ -f "$MoveDir/$ShowFileName.$originalext" ]; then
 +
MythSExxCounter=0
 +
NameCheck="0"
 +
while [ $NameCheck = "0" ]; do
 +
let MythSExxCounter=$MythSExxCounter+1
 +
 +
if [ ! -f "$MoveDir/$ShowFileName-$MythSExxCounter.$originalext" ];then
 +
NameCheck="1"
 +
ShowFileName=`echo "$ShowFileName-$MythSExxCounter"`
 +
fi
 +
done
 +
fi
 +
 +
#If symlink is not in LINK mode, Move and rename the file.
 +
if [ $SYMLINK != "LINK" ]; then
 +
mv "$3" "$MoveDir/$ShowFileName.$originalext"
 +
 +
#Alternate Move dir used if original move dir does not work
 +
if [ ! -f "$MoveDir/$ShowFileName.$originalext" ]; then
 +
MoveDir=$AlternateMoveDir
 +
echo "COULD NOT CREATE FILE. USING ALTERNATE MOVE DIR: $AlternateMoveDir"
 +
mv "$3" "$MoveDir/$ShowFileName.$originalext"
 +
fi
 +
#If symlink is in LINK mode then create symlink
 +
elif [ $SYMLINK = "LINK" ]; then
 +
ln -s "$3" "$MoveDir/$ShowFileName.$originalext"
 +
fi
 +
 +
#Check and report if file was moved
 +
if [ -f "$MoveDir/$ShowFileName.$originalext" ]; then
 +
echo "@@@@@@@@@@@@@OPERATION COMPLETE" `date` "@@@@@@@@@@@@@@@">>$MythSExx/output.log
 +
if [ $SYMLINK = "MOVE" ]; then
 +
ln -s "$MoveDir/$ShowFileName.$originalext" "$3"
 +
fi
 +
#send notification if enabled
 +
  if [ $Notify = "Enabled" ]; then
 +
sudo -S su "$NotifyUserName" alt-notify-send "MythSExx Sucess" "$ShowFileName moved to $MoveDir" info
 +
fi
 +
exit 0
 +
#Failsafe mode. Failsafe will create a symlink.  Failsafe is always a operation failure.
 +
elif [ ! -f "$MoveDir/$ShowFileName.$originalext" ]; then
 +
echo "ATTEMPTED MOVE:$3">>$MythSExx/output.log
 +
echo "TO:$MoveDir/$ShowFileName.$originalext">>$MythSExx/output.log
 +
echo "PERMISSION ERROR OR DRIVE FULL">>$MythSExx/output.log
 +
if [ FailSafeMode = "Enabled" ]; then
 +
echo "ATTEMPTING SYMLINK TO FAILSAFE DIR: $FailSafeDir">>$MythSExx/output.log
 +
ln -s "$3" "$FailSafeDir/$ShowFileName.$originalext"
 +
if [ -f "$FailSafeDir/$ShowFileName.$originalext" ]; then
 +
echo "FAILSAFE MODE COMPLETE: SYMLINK CREATED">>$MythSExx/output.log
 +
fi
 +
if [ ! -f "$FailSafeDir/$ShowFileName.$originalext" ]; then
 +
echo "FAILSAFE MODE FAILURE CHECK PERMISSIONS IN $FailSafeDir">>$MythSExx/output.log
 +
fi
 +
fi
 +
echo "%%%%%%%%%%%%%OPERATION FAILURE" `date` "%%%%%%%%%%%%%%%%%">>$MythSExx/output.log
 +
  #send notification if enabled
 +
  if [ $Notify = "Enabled" ]; then
 +
sudo -S su "$NotifyUserName" alt-notify-send "MythSExx Error" "Error moving $3 to $MoveDir/$ShowFileName" error
 +
fi
 +
fi
 +
 +
#If move dir dosn't exist, then outpt it in the log
 +
elif [ ! -d $MoveDir ]; then
 +
echo "OUTPUT FOLDER $MoveDir DOES NOT EXIST">>$MythSExx/output.log
 +
echo "failure" `date`
 +
 +
#Log error if problem exists
 +
echo mv "$3" "$MoveDir/$ShowFileName"
 +
elif [ "$exx" = "" ]; then
 +
echo "NO MATCH FOUND.  TROUBLESHOOTING: Check www.TheTvDb TO SEE IF $1 EXISTS. ">>$MythSExx/output.log
 +
echo "CHECK $2. CHECK INTERNET CONNECTION. CHECK API KEY.">>$MythSExx/output.log
 +
echo "CHECK www.TheTvDb.com  RUN MythSExx LINK COMMAND PROMPT. FOR MORE INFORMATION SEE http://wiki.xbmc.org/index.php?title=MythSExx">>$MythSExx/output.log
 +
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
 +
#send notification if enabled
 +
  if [ $Notify = Enabled ]; then
 +
sudo -S su "$NotifyUserName" alt-notify-send "MythSExx error" "MythSExx Move operation failed See $MythSExx/output.log for more information" error
 +
fi
 +
exit 1
 +
fi
 +
== creating a rotating MythSExx library ==
 +
The following is instructions for setting a dynamic library for XBMC
  
Now perform a default install.
+
=== MythTV Settings === 
 +
*Click System/Administration MythTV Baclend setup
 +
*Select "1. General" then select next until you get to screen 3
 +
*Check "Follow symbolic links when deleting files". 
 +
*Select next until you get to screen 8
 +
*Check "Allow user job #1 Jobs"
 +
*Select next until you get to screen 10
 +
UserJob #1 Description: MythSExx
 +
User Job #1 Command: /home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
 +
*Select Finish to exit
 +
*Select 6. Storage Directories
 +
*Select Default
 +
*Add a recording folder to which MythTV has access ie. /home/mythtv/Videos
 +
*Add additional folders if required.
 +
*Remove folders to which MythTV cannot run move jobs such as /lib or /var
  
* '''When asked during the installation, please set „xbmc” as username and password at the account creation.'''
 
  
* At the end, when you have to choose from the optional components, check only „OpenSSH” to be able to access your HTPC remotely via SSH.
 
  
''Apparently there seems to be an issue with '''''Intrepid''''' installer. If you are using flash drive, it's not installing GRUB for some reason.'' '''''<BR>This is only affect Intrepid, and only when you are installing it onto a flash drive.'''''
+
== Enabling Notifications ==
 +
Notifications will occour at the end of every operation conducted by MythSExx. Notifications will let you know when it is time to update your XBMC Library.
  
''To handle this, you have to options:''
+
=== Installing notify-send ===
# ''Either install Hardy(Ubuntu 8.04) mini.iso first, which is installing GRUB correctly, then right after that, install Intrepid mini.iso over the same flash drive. It will reformat the drive, but GRUB will stay alive on the drive.''
+
Libnotify-bin contains the file which allows the terminal to send commands to the GNOME desktop.
# ''Second option is that right after Intrepid mini installation, boot up Intrepid mini.iso from the CD again, choose rescue mode, and there you will find an "install GRUB" option.''
+
  
After you’ve done, boot it up, then use an SSH application (e.g. putty) to log in remotely from your desktop, using the above created username and password. This way, you will be able to copy/ paste all the steps below. Alternatively you can use console on the htpc too, but then you will have a hard time type in everything.
+
*open a terminal
 +
apt-get install libnotify-bin
  
So once you logged in:
 
  
 +
=== Setting permissions ===
 +
The following procedure is a security risk, however unless a better way is found, this is the only way.
  
'''First of all, update the repositories, and install all prerequisites:'''
+
*type the following
 +
visudo
  
'''NEXT STEP'''
+
*add the following line to visudo
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
%mythtv ALL=(ALL) NOPASSWD:ALL
# sudo apt-get update
+
*save and exit
</div>
+
  
'''NEXT STEP Hardy''' - <span style="color:red">Skip this and jump to '''''NEXT STEP Intrepid''''', if you are installing Intepid</span> <BR>
+
=== Enable Send to GNOME ===
<div style="height: auto; width: 1000px; overflow:auto; border: thin inset black; background: #E6E6FA">
+
To enable notifications to be sent to the desktop from a different user, you will need to use the alt-notify-send script.
# sudo apt-get --purge autoremove -y nvidia-kernel-common linux-restricted-modules-generic linux-restricted-modules-common linux-restricted-modules-2.6.24-23-generic
+
</div>
+
  
'''NEXT STEP Hardy''' - <span style="color:red">Skip this and jump to '''''NEXT STEP Intrepid''''', if you are installing Intepid</span> <BR>
+
*place the following script in /usr/local/bin/
<div style="height: auto; width: 1000px; overflow:auto; border: thin inset black; background: #E6E6FA">
+
filename: alt-notify-send
  # sudo apt-get install -y linux-headers-generic localepurge subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libfribidi-dev liblzo-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl4-gnutls-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libtre-dev libogg-dev libvorbis-dev libmysqlclient15-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxmu-dev libpng12-dev libjpeg-dev mesa-utils wget zip curl hal build-essential linux-headers-`uname -r` xorg pm-utils
+
#!/bin/bash
</div>
+
  user=`whoami`
 +
pids=`pgrep -u $user gnome-session`
 +
title=$1
 +
text=$2
 +
timeout=$3
 +
 +
if [ -z "$title" ]; then
 +
        echo You need to give me a title >&2
 +
        exit 1
 +
fi
 +
if [ -z "$text" ]; then
 +
          text=$title
 +
fi
 +
if [ -z "$timeout" ]; then
 +
        timeout=60000
 +
fi
 +
 +
for pid in $pids; do
 +
        # find DBUS session bus for this session
 +
        DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
 +
                /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
 +
        # use it
 +
        DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
 +
        notify-send -u low -i $4 $timeout "$title" "$text"
 +
done
  
'''NEXT STEP Intrepid'''<BR>
+
*Make it executable
<div style="height: auto; width: 1000px; overflow:auto; border: thin inset black; background: #E6E6FA">
+
  sudo chmod +x /usr/local/bin/alt-notify-send
# sudo apt-get install -y localepurge subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libfribidi-dev liblzo-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl4-gnutls-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libtre-dev libogg-dev libvorbis-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxmu-dev libpng12-dev libjpeg-dev mesa-utils wget zip curl build-essential linux-headers-`uname -r` xorg pm-utils
+
</div>
+
 
+
During the installation of the packages, there will be a popup window to choose your locale languages to let "localepurge" know which locales not to remove in further installations. I would suggest to keep all en_us (3 all together) and your own country locales (again should be 3) as well. Localepurge will save you some space with removing unneccessary languages.<BR>
+
 
+
= Upgrading ALSA (sound driver) to the latest version =
+
 
+
I have modified the ALSA upgrade script (available at Ubuntuforums), and now it is working with only “-di” option in our case here (Also on ASUS P5N7A-VM).
+
 
+
To download and use the script:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# wget http://217.20.138.65/xbmc/AlsaUpgrade-1.0.x-rev-1.16.sh
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# chmod a+x AlsaUpgrade-1.0.x-rev-1.16.sh
+
</div>
+
 
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo ./AlsaUpgrade-1.0.x-rev-1.16.sh -di
+
</div>
+
 
+
If you are on Intrepid, you have to add the user created at installation to the „audio” group (you don't need to do that in case of Hardy).
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo usermod -a -G audio xbmc
+
</div>
+
('''''Please note:''''' replace „xbmc” with username you installed with)
+
 
+
<BR>
+
You also have to edit the following file to make spdif and/or hdmi work properly:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/modprobe.d/alsa-base
+
</div>
+
 
+
and add this line to the end:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
options snd-hda-intel model=6stack-dig
+
</div><BR>
+
 
+
reboot the computer:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo reboot
+
</div>
+
 
+
For some reason, the driver snapshot for ALSA 1.0.19 is not always downloading properly; in this case you have to run the script again. To check whether the driver upgraded or not:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# more /proc/asound/version
+
</div>
+
 
+
If you see driver version 1.0.19 here, you can continue, but it's shows 1.0.17 as driver version, then you have to repeat the last 3 step (upgrade, reboot, check).
+
 
+
If it’s OK, then you can delete the just downloaded ALSA source to free up some disk space:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo rm -r /usr/src/Alsa-1.0.19/
+
</div>
+
 
+
Now run alsamixer:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# alsamixer
+
</div>
+
 
+
Navigate right with cursor keys until IEC958 and unmute all three of them (IEC958) with „M” key. You should see in case of all three IEC958 a „00” in green background. Press „ESC” to quit from alsamixer.
+
 
+
= Update Video driver =
+
 
+
== Nvidia==
+
 
+
''(For Ati owners: jump to [[#Ati]])''
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# wget ftp://download.nvidia.com/XFree86/Linux-x86/180.37/NVIDIA-Linux-x86-180.37-pkg1.run
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo sh NVIDIA-Linux-x86-180.37-pkg1.run
+
</div>
+
 
+
In the nvidia installer: accept the License agreement, choose „YES” for „No precompiled kernel interface...”, choose „OK” for „No matching precompiled kernel interface...”, than choose „YES” to update X configuration file, than finally „OK” again at the end.
+
 
+
Now you can delete Nvidia installer:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# rm NVIDIA-Linux-x86-180.37-pkg1.run
+
</div>
+
 
+
=== xorg.conf configuration (Nvidia) ===
+
 
+
If you want your Xorg autodetect the native resolutions from EDID and want to use 24p you have to replace your xorg.conf with this (not guaranteed to work, but should with newer Nvidia cards):
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/xorg.conf -O /etc/X11/xorg.conf
+
</div>
+
 
+
'''''(To continue click on: [[#Download, compile, and install XBMC from source]] (skip section Ati))'''''
+
 
+
<BR>
+
 
+
== Ati ==
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get install -y cdbs fakeroot dh-make debhelper debconf libstdc++5 dkms
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# wget http://www2.ati.com/drivers/linux/ati-driver-installer-8-12-x86.x86_64.run
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo sh ati-driver-installer-8-12-x86.x86_64.run --buildpkg Ubuntu/intrepid
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo dpkg -i xorg-driver-fglrx_8.561-0ubuntu1_i386.deb fglrx-kernel-source_8.561-0ubuntu1_i386.deb fglrx-amdcccle_8.561-0ubuntu1_i386.deb
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# rm ati-driver-installer-8-12-x86.x86_64.run  *.deb
+
</div>
+
 
+
=== xorg.conf configuration (Ati) ===
+
Will be discussed later, stay tuned
+
 
+
<BR>
+
 
+
= Download, compile, and install XBMC from source =
+
 
+
'''NEXT STEP''' - <span style="color:red">This is the main trunk, skip to the following step, if you want to use vdpau<BR>
+
<div style="height: auto; width: 1000px; overflow:auto; border: thin inset black; background: #E6E6FA">
+
# svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC
+
</div>
+
 
+
In case of Hardy, you will get a certificate warning, accept it permanetly by pressing „P”.
+
Wait for downloading XBMC source files, might takes long time, depend on your Internet connection.
+
 
+
'''OPTIONAL STEP''' - <span style="color:red">In case you want to use vdpau branch, skip if you choosed the main trunk<BR>
+
'''''You have to have vdpau compatible VGA vard for this with 512MB video ram at least!'''''
+
<div style="height: auto; width: 1000px; overflow:auto; border: thin inset black; background: #E6E6FA">
+
# svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/xbmc-vdpau/XBMC
+
</div>
+
 
+
In case of Hardy, you will get a certificate warning, accept it permanetly by pressing „P”.
+
Wait for downloading XBMC source files, might takes long time, depend on your Internet connection.
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# cd XBMC
+
</div>
+
 
+
Then configure, compile, and install XBMC:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# ./configure --prefix=/usr --disable-pulse
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# make -j2 ('''''Please note''''': use only „make”, if you don’t have a dualcore CPU)
+
</div>
+
 
+
This is again, can take quite some time, depending on your CPU speed.
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
  # sudo make install
+
</div>
+
 
+
<BR>
+
 
+
= Autoboot to XBMC =
+
 
+
'''WARNING!!! Do NOT follow this section unless you understand what EVERY step is actually doing.  The original author hasn't thoroughly explained each step. If something goes wrong you WILL NOT be able to easily get to a normal desktop, so if you aren't 100% comfortable with recovering any and all issues in Linux from the command line, THINK TWICE!!!  You can easily setup gdm to auto login and gnome to autostart XBMC.'''
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/xbmc -O /etc/init.d/xbmc
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo chmod a+x /etc/init.d/xbmc
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo update-rc.d -f xbmc defaults
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/runXBMC.sh -O /usr/bin/runXBMC.sh
+
</div>
+
If you not choosed "xbmc" as your user at the installation, you have to modify this file according to your username.
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo chmod a+x /usr/bin/runXBMC.sh
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/setAlsaVolumes.py -O /usr/bin/setAlsaVolumes.py
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo chmod a+x /usr/bin/setAlsaVolumes.py
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo dpkg-reconfigure x11-common
+
</div>
+
And choose "anyone" to run X. Leave the other question on default.
+
 
+
<BR>
+
 
+
= Install Lirc =
+
 
+
I've found MS MCE Remotes, listed here: http://www.mythtv.org/wiki/MCE_Remote, are plug & plays, working out of the box. I also found, that there're remotes out there, which instalation are a real pain. The choise is yours. If you have one of the above mentioned MS MCE remotes, the installation is that simple:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get install -y lirc
+
</div>
+
 
+
And follow the wizard.
+
 
+
<BR>
+
= Power Management =
+
 
+
To be able to control power management (suspend, shutdown, reboot) from within XBMC, you have to modify PolicyKit.conf to grant privilegies to your user for power management. There is a preprepared PolicyKit.conf for this, you can get it by:
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/PolicyKit.conf -O /etc/PolicyKit/PolicyKit.conf
+
</div>
+
Please note: if you installed your system with username other than "xbmc" at the begining, you have to modify that in the file.
+
 
+
 
+
If you wish to enable CPU scaling, install the required packages as the following, but '''don’t forget to enable it in the BIOS as well'''.
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get install powernowd
+
</div>
+
 
+
<BR>
+
 
+
= Install Splash =
+
You may want to have a look at du-duke's fantastique splash screens. You can check these here: http://du-duke.blogspot.com/
+
You can download your choice below.
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get -y install usplash libusplash-dev
+
</div>
+
 
+
'''NEXT STEP Hardy''' - <span style="color:red">Skip this and jump to '''''NEXT STEP Intrepid''''', if you are installing Intepid</span> <BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get -y install usplash-theme-ubuntu
+
</div>
+
 
+
'''NEXT STEP Hardy''' - <span style="color:red">Skip this and jump to '''''NEXT STEP Intrepid''''', if you are installing Intepid</span> <BR>
+
'''<span style="color:red">CHOICE 1</span> - Downloading spinner-blue'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/splash/usplash-spinner-hardy.so -O /usr/lib/usplash/usplash-theme-ubuntu.so
+
</div>
+
 
+
'''NEXT STEP Hardy''' - <span style="color:red">Skip this and jump to '''''NEXT STEP Intrepid''''', if you are installing Intepid</span> <BR>
+
'''<span style="color:red">CHOICE 2</span> - Downloading pulsating-logo'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/splash/usplash-pulsating-hardy.so -O /usr/lib/usplash/usplash-theme-ubuntu.so
+
</div>
+
 
+
'''NEXT STEP Intrepid'''<BR>
+
'''<span style="color:red">CHOICE 1</span> - Downloading spinner-blue'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/splash/usplash-spinner-intrepid.so -O /usr/lib/usplash/usplash-theme-ubuntu.so
+
</div>
+
 
+
'''NEXT STEP Intrepid'''<BR>
+
'''<span style="color:red">CHOICE 2</span> - Downloading pulsating-logo'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo wget http://217.20.138.65/xbmc/splash/usplash-pulsating-intrepid.so -O /usr/lib/usplash/usplash-theme-ubuntu.so
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/usplash.conf
+
</div>
+
 
+
and set your desired splash resolution, so inserting the following to here.
+
('''''Please note:''''' this is a FullHD example):
+
 
+
<div style="height: auto; border: thin inset black; background: #E6E6FA">
+
xres=1920<BR>
+
yres=1080
+
</div>
+
 
+
'''NEXT STEP'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo update-initramfs -u
+
</div>
+
 
+
<BR>
+
 
+
= Enable thermal monitoring =
+
 
+
To install the necessary package:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get install -y lm-sensors
+
</div>
+
 
+
Once lm-sensors installed, you have to run sensor detection to identify your sensors:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo sensors-detect
+
</div>
+
There will be a lot of questions here, but you can answer by "enter" key to all of them, '''except the last question'''.
+
So answer "enter" to all questions, until you see the the question "Do you want to add these lines automatically?" At here, you have to type "yes", then enter.
+
 
+
Reboot the computer:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo reboot
+
</div>
+
 
+
After rebooted, check if the sensors are working:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sensors -u
+
</div>
+
You should see the output of the sensors here.<BR>
+
 
+
== XBMC CPU temp detection ==
+
 
+
To let XBMC detect your CPU temps provided by lm-sensors, you have to edit your advancedsettings.xml and insert the following:
+
<div style="height: auto; border: thin inset black; background: #E6E6FA">
+
<advancedsettings> <BR>
+
<cputempcommand>echo "$(sensors | grep "Core 0" | sed -e 's/[a-z]*..............\([0-9].\)\..*/\1/') C"</cputempcommand> <BR>
+
</advancedsettings> <BR>
+
</div> <BR>
+
 
+
== XBMC GPU (nvidia) temp detection ==
+
To let XBMC detect your GPU temps provided by nvidia-settings, you have to edit your advancedsettings.xml and insert the following:
+
<div style="height: auto; border: thin inset black; background: #E6E6FA">
+
<advancedsettings> <BR>
+
<gputempcommand>echo "$(nvidia-settings -tq gpuCoreTemp) C"</gputempcommand> <BR>
+
</advancedsettings> <BR>
+
</div>
+
 
+
 
+
<BR>
+
 
+
= Enable eject button of your ODD =
+
 
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/sysctl.conf
+
</div>
+
 
+
and uncomment (by deleting # from the begining of the line) the last line, so it will look like this:
+
 
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
dev.cdrom.lock=0
+
</div>
+
 
+
<BR>
+
= Reduce boot time =
+
 
+
'''reduce GRUB waiting (~2 sec)'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /boot/grub/menu.lst
+
</div>
+
 
+
Find the timeout (currently set to 3) and change this to 0
+
 
+
 
+
'''reduce the number of loaded vts (virtual terminal service)'''<BR>
+
 
+
By default, there're F1 through F7, we don't need that much for a HTPC, so we can remove most of them.
+
 
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/event.d/tty3
+
</div>
+
 
+
and comment out all the lines, using #.
+
Repeat the above command for tty4-tty6, so at the end you've deactivated 3 vts's.
+
 
+
 
+
'''Enable concurrent booting (if you own a dual-core CPU)'''<BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/init.d/rc
+
</div>
+
 
+
Find the line "CONCURRENCY=none" and change it to "CONCURRENCY=shell"
+
 
+
 
+
'''Disable unneccessary services'''<BR>
+
Install the necessary application
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get -y install sysv-rc-conf
+
</div><BR>
+
 
+
And run it:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo sysv-rc-conf
+
</div>
+
Navigate with your cursor keys, you can disable services by clearing X in each runlevel by "space" key.<BR>
+
You can disable the following services:
+
<BR>
+
* apparmor<BR>
+
* dns-clean<BR>
+
* fancontrol (unless you're using it)<BR>
+
* pppd-dns<BR>
+
* rsync<BR>
+
 
+
<BR>
+
 
+
= BIOS OEM Splash screen =
+
Recent motherboards usually featured with the possibility to change to BIOS OEM logo. Below you can find a modified XBMC logo. The format and size of the picture has been modified to fit into the BIOS (ASUS P5N7A-VM), '''''there is no guarantee to work with any other motherboard, but I guess it should work with all boards with newer AMI bioses.'''''
+
 
+
'''''BE AWARE! I take no responsibility if you brick your motherboard while playing with BIOS.'''''
+
 
+
In case of ASUS, you can do it with MyLogo2, which is a bundled tool for your MB.
+
 
+
The aspect ratio of the picture is like this for purpose. When your BIOS displays it, it will stretch to fit to the screen. So this is made for 16:9 (not for 4:3, and nor for 16:10)
+
 
+
[[Image:Bios splash pwrd by xbmc.jpg|360px|http://217.20.138.65/xbmc/pwrd_by_xbmc_bios_splash.bmp]] [[Image:Bios splash oldFor16x9.jpg|360px|http://217.20.138.65/xbmc/Splash_oldFor16x9.bmp]]
+
<BR>[http://217.20.138.65/xbmc/pwrd_by_xbmc_bios_splash.bmp Download1] [http://217.20.138.65/xbmc/Splash_oldFor16x9.bmp Download2]
+
 
+
 
+
<BR>
+
 
+
= Wake On Lan =
+
 
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo apt-get install -y ethtool
+
</div><BR>
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo nano /etc/init.d/wol.sh
+
</div>
+
 
+
Copy the following text into it, then save the file:
+
 
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
ethtool -s eth0 wol g
+
</div><BR>
+
Make this newly created script executable:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo chmod a+x /etc/init.d/wol.sh
+
</div><BR>
+
Make it start during boot:
+
<div style="height: 32px; border: thin inset black; background: #E6E6FA">
+
# sudo update-rc.d -f wol.sh defaults
+
</div>
+
 
+
<BR>
+
= Sound configuration in XBMC =
+
 
+
After booted into XBMC switch to „digital” audio output, than '''''choose the AC3 and DTS capabilities''''' according to your receiver.
+
 
+
<BR>'''''For SPDIF:'''''                                   
+
<BR>Leave audio output device: default           
+
<BR>Leave passthrough to IEC958                   
+
<BR>[[Image:Audio_iec958_default_1.jpg]]
+
<BR> 
+
 
+
'''''For HDMI:'''''
+
<BR>Change audio output device to hdmi
+
<BR>Change passthrough to hdmi
+
<BR>[[Image:Audio hdmi.jpg|Audio hdmi.jpg]]
+
<BR>(you will loose analog sound eg. navigation sound in case of hdmi)
+
<BR>
+
 
+
= MythTV =
+
 
+
You may want to have a look at here:
+
 
+
http://wiki.xbmc.org/?title=MythTV
+

Revision as of 23:16, 11 December 2009

This page is under construction


MythSExx allows you to export your dynamic MythTV library into XBMC.


Key features:

  • MythTV recordings renamed to Show name.SxxExx (episode title).ext
  • Symlinks allow MythTV to maintain your library. Symlink from new file in place of old. Symlink to original.
  • TvDb recognition of Show Name and Episode Name
  • Fuzzy logic episode name matching allows for improperly named episodes
  • User defined show name translations for improper guide data
  • User is notified at the end of each operation
  • Dynamic mount support with alternate move dir
  • Failsafe Symlink mode
  • easy to troubleshoot permission errors and other problems in debug mode
  • Can be run as MythTV job.
/home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"

in progress:

  • multiple shows in single recordings (currently handled by clipping second name)

Contents

1 MythSExx

  • Create the following file

Filename: /home/mythtv/MythSExx/MythSExx.sh

#!/bin/bash

#MythSExx by Adam Outler
#email: outleradam@hotmail.com
#Software the way it should be: Free and Open Source
#Please contact me with any bug reports

#Intention:
# This program was designed to be a user job in MythTV.  It can be called by creating a user job.
# The user job can be called as follows:
# /home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
#
#Usage:
#  MythSExx.sh -v "show name" "episode name" "Target Folder"
#  eg. MythSExx.sh "South Park" "Here Comes the Neighborhood" "/home/mythrecordings/2308320472023429837.mpg"
#  
#Output:
# If an error occurs and the file cannot be moved, then no change will occur to the original file. If the Movedir
# is full or not available, such as when running a NAS and the computer is disconnected from the network, the 
# AlternateMoveDir will be used. If both of these dirs fail, the show will be SymLinked in the FailSafeDir.
# You may elect to run the user job at a later time when the issue has been resolved.  Output dir will depend 
# on user settings. The file name however, is preset to the most acceptable standard:
#   Show Title - SxxExx (Episode Title).ext
#
#Symlinking:
# When Symlinking is enabled, MythSExx will follow it's normal mode of operation.  In MOVE mode, MythSExx will
# Create a symlink from the new file in the same name and location of the old file.  In LINK mode, MythSExx will 
# not move the file, LINK mode creates a new symlink to the original file. 
#
#Logging:
# Log file will show information for troubleshooting. You can find the log file in the working folder
# Log file default location: /home/$username/MythSExx
#
#Dependencies: depends on "Curl" and "agrep" and "libnotify-bin"
# install curl with "apt-get install curl"  
# install agrep with "apt-get install agrep"
# optional: install libnotify-bin with "apt-get install libnotify-bin" 
#
#Show Name Translation
# The user may elect to create a file in the MythSExx/ working folder which will then translate any recorded
# show name into the desired show name.  This is useful for adding a year to distinguish between a new series
# and an older series and/or typos in your guide data.  By default it should be called "showtranslations" and
# by default it will be in your home/username/MythSExx folder.  showtranslations is not needed by most users
# and the file should only be created if it is needed. Under most circumstances, the integrated fuzzy logic 
# will be sufficient to translate the guide name to the TvDb name, however showtranslations is available to 
# improve accuracy to 100%. The format of showtranslations is as follows:
#Filename: /$MythSExx/showtranslations
##############################################################
#My Guide Show Title = www.TheTvDb.com Show Title            #
#Battlestar Gallactica = Battlestar Gallactica (2003)        # 
#Millionaire = Who Wants To Be A Millionaire                 #
#Aqua teen Hungerforce = Aqua Teen Hunger Force              #
##############################################################


#######################USER SETTINGS##########################
#MoveDir is the folder which MythSExx will move the file.  No trailing / is accepted eg. "~/videos"
MoveDir="/home/mythtv/NAS/Video/shows"
#AlternateMoveDir will act as a seccondary MoveDir if the primary MoveDir fails.
AlternateMoveDir="/home/mythtv/Shared"
#Disable moving of files.  If UseOriginalDir is Enabled, original dir will override MoveDir.  This can be useful for multiple recording dirs   Enabled|Disabled
UseOriginalDir=Disabled
#When Enabled, MythSExx will move the file to a folder of the same name as the show. This is not affected by UseOriginalDir. Enabled|Disabled
UseShowNameAsDir=Enabled
#SYMLINK has 3 modes.  MOVE|LINK|Disabled
#Create symlink in original dir from file after MOVE, Create symlink in MoveDir LINK original(overrides moving), Simlinking Disabled 
SYMLINK=MOVE
#Internet access Timeout in seconds: Default Timeout=50 
Timeout=50 
#MythSExx working file dir: Default is "~/MythSExx" 
MythSExx=~/MythSExx
#FailSafe mode will enable symlinks to be formed in FailSafeDir if the move or symlink operation fails.
FailSafeMode=Enabled
#FailSafeDir is used when the file cannot be moved to the MoveDir. FailSafe will not create folders.
FailSafeDir=~
#The following line tells MythSExx to send a notification upon completion. Enabled|Disabled
Notify=Enabled
#If notifications are enabled, NotifyUserName should be the same as the user logged into the GNOME Session.
NotifyUserName="adam"
#the following line contains the API key from www.TheTvDb.Com. Default: 6DF511BB2A64E0E9
APIkey="6DF511BB2A64E0E9"
#Enables debug mode.  This is a verbose mode of logging which should be used for troubleshooting.  Enabled|Disabled
DEBUGMODE=Enabled
#########################USER SETTINGS########################## 

###############################################################
################Do not modify below this line##################
###############################################################
echo "@@@@@@@@@@NEW SEARCH INITIATED AT `date`@@@@@@@@@@@@@">>$MythSExx/output.log 

#####DEFINE ENVIRONMENT AND VARIABLES#####
#make our working dir if it does not exist
if [ ! -d "$MythSExx" ]; then 
	mkdir $MythSExx
	echo "creating home/MythSExx and log file">>$MythSExx/output.log
fi

#Set episode name, dir, extension, and showname from the input parameters.
ShowName=$1
epn=`echo $2|sed 's/;.*//'|tr -d [:punct:]`
originalext=`echo "${3#*.}"`
originaldirname=`dirname "$3"`

#Check for show translations relating to the show in question.
if [ -f $MythSExx/showtranslations ]; then 
	showtranslation=`grep "$ShowName = " "$MythSExx/showtranslations"|replace "$ShowName = " ""|replace "$MythSExx/showtranslations" ""`		 
	if [ "$showtranslation" != "$null" ];then 
		ShowName=$showtranslation
		echo "USER TRANSLATION: $ShowName = $ShowNametranslation">>$MythSExx/output.log
	elif [ "$showtranslation" = "$null" ];then
		$showtranslation = "Inactive"
	fi
fi

if [ $UseOriginalDir = "Enabled" ]; then
	MoveDir=`echo "$originaldirname"`
fi

#####SEARCH FOR SHOW NAME#####
echo "SEARCHING: www.TheTvDb.com SHOW NAME: $ShowName EPISODE: $epn">>$MythSExx/output.log
echo "FILE NAME: $3">>$MythSExx/output.log
#download series info for show, parse into temporary text db- sid.txt shn.txt
tvdbshowname=`echo $ShowName|replace " " "%20"`

curl -s -m"$Timeout" www.thetvdb.com/api/GetSeries.php?seriesname=$tvdbshowname>$MythSExx/working.xml
cat $MythSExx/working.xml | grep "<seriesid>"|replace "<seriesid>" ""|replace "</seriesid>" "">$MythSExx/sid.txt
cat $MythSExx/working.xml | grep "<SeriesName>"|replace "<SeriesName>" ""|replace "</SeriesName>" "">$MythSExx/shn.txt

#Use fuzzy logic to make the best match of the show name
serieslinenumber=`agrep -Byn "${showname:0:29}" $MythSExx/shn.txt|sed 's/:.*//'|grep -m1 ^`

#Get the seriesid based on the showname
seriesid=`sed -n $serieslinenumber'p' $MythSExx/sid.txt|grep -m1 ^`
NewShowName=`sed -n $serieslinenumber'p' $MythSExx/shn.txt|grep -m1 ^`

#Create folder for database if it does not exist
if [ ! -d "$MythSExx/$NewShowName" ]; then
	mkdir $MythSExx/"$NewShowName"
	echo "creating home MythSExx and log file">>MythSExx/output.log
fi
	echo "SEARCH FOUND:""$NewShowName" "ID#:" $seriesid >>/$MythSExx/output.log

#If series ID is obtained, then get show information.
if [ "$seriesid" != "" ]; then

#####GET SHOW INFORMATION#####
#Strip XML tags
	seriesid=`echo $seriesid|tr -d "<seriesid>"|tr -d "</seriesid>"`

#download series info for series id
	curl -s -m"$Timeout" "http://www.thetvdb.com/api/$APIkey/series/$seriesid/all/en.xml">$MythSExx"/$NewShowName/$NewShowName.xml"

#create a folder/file "database" Strip XML tags.  Series, Exx and Sxx are separated into different files
	if [ -f "$MythSExx/$NewShowName/$NewShowName.xml" ]; then 
		cat "$MythSExx/$NewShowName/$NewShowName.xml" | grep "<EpisodeName>"|replace "  <EpisodeName>" ""|replace "</EpisodeName>" ""|replace "/" "">$MythSExx/"$NewShowName"/"$NewShowName".Ename.txt
		cat $MythSExx/"$NewShowName"/"$NewShowName".xml | grep "<SeasonNumber>"|replace "<SeasonNumber>" ""|replace "</SeasonNumber>" ""|replace " " "">$MythSExx/"$NewShowName"/"$NewShowName".S.txt
		cat $MythSExx/"$NewShowName"/"$NewShowName".xml | grep "<EpisodeNumber>"|replace "<EpisodeNumber>" ""|replace "</EpisodeNumber>" ""|replace " " "">$MythSExx/"$NewShowName"/"$NewShowName".E.txt
	elif [ ! -f "$MythSExx/$NewShowName/$NewShowName.xml" ]; then
		echo "***FAILURE: curl -s -m$Timeout http://www.thetvdb.com/api/$APIkey/series/$seriesid/all/en.xml">>$MythSExx/output.log
	fi

#check if files were created and generate message
	if [ -f $MythSExx/"$NewShowName"/"$NewShowName".Ename.txt ]; then
		echo "LOCAL DATABASE UPDATED:$MythSExx/$NewShowName"
	elif [ ! -f "$MythSExx/$NewShowName/$NewShowName.Ename.txt" ]; then
		echo "*** PERMISSION ERROR $MythSExx/$NewShowName/">>$MythSExx/output.log
	fi


#####PROCESS SHOW INFORMATION#####
#grep use fuzzy logic to find the closest show name from the locally created database and return absolute episode number
	absolouteEpisodeNumber=`agrep -Byn "${epn:0:29}" "$MythSExx""/""$NewShowName""/""$NewShowName"".Ename.txt"|grep -m1 ^|sed 's/:.*//'`
	echo DEFINED ABSOLOUTE EPISODE NUMBER: $absolouteEpisodeNumber>>$MythSExx/output.log

#if line match is obtained, then gather Sxx and Exx
	if [ "$absolouteEpisodeNumber" !=  ""  ]; then
		epn=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".Ename.txt|sed 's/;.*//'`
		echo "Found Match: $epn $absolouteEpisodeNumber"
#gather series and episode names from files created earlier.
		exx=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".E.txt`
		sxx=`sed -n $absolouteEpisodeNumber'p' $MythSExx/"$NewShowName"/"$NewShowName".S.txt`

# Single digit episode and show names are not allowed Ex and Sx replaced with Exx Sxx
		if [ "$exx" -lt 10 ]; then 
			exx=`echo E0$exx`
		elif [ "$exx" -gt 9 ]; then 
			exx=`echo E$exx`
		fi
		if [ "$sxx" -lt 10 ]; then 
			sxx=`echo S0$sxx`
		elif [ "$sxx" -gt 9 ]; then 
			sxx=`echo S$sxx`
		fi
	fi

#if1 exit point
	elif [ "$seriesid" == "" ]; then 
 	echo "series was not found the tvdb may be down try renaming $1">>$MythSExx/output.log
fi
#####OUTPUT#####
if [ $DEBUGMODE = "Enabled" ]; then
	echo "#########################################################">>$MythSExx/output.log
	echo "###################DEBUG MODE ENABLED####################">>$MythSExx/output.log
	echo "#########################################################">>$MythSExx/output.log
	echo "LISTING INTERNAL VARIABLES USED BY MythSExx. VERIFY THESE ARE NOT EFFECTED BY GLOBAL VARIABLES">>$MythSExx/output.log
	echo "INTERNET TIMEOUT:$Timeout- TvDb API KEY:$APIkey- MythSExx WORKING DIR:$MythSExx-">>$MythSExx/output.log
	echo "MOVE DIR:$MoveDir- USING SHOWNAME AS FOLDER:UseShowNameAsDir-">>$MythSExx/output.log
	echo "FAILSAFE MODE:$FailSafe- FAILSAFE DIR:$FailSafeDir- ALTERNATE MOVE DIR:$AlternateMoveDir-"
	echo "USE ORIGINAL DIR:$UseOriginalDir NOTIFICATIONS:$Notify DEBUG MODE:$DEBUGMODE-">>$MythSExx/output.log
	echo "INPUT SHOW NAME:$1- LOCAL SHOW NAME TRANSLATION:$showtranslation- SENT TVDB SHOW NAME:$tvdbshowname-">>$MythSExx/output.log
	echo "RESOLVED SERIES ID:$seriesid- RESOVED SHOW NAME:$ShowName-">>$MythSExx/output.log
	echo "INPUT EPISODE NAME:$2- ABSOLOUTE EPISODE NUMBER:$absolouteEpisodeNumber- RESOLVED EPISODE NAME:$epn-">>$MythSExx/output.log
	echo "SEASON:$sxx- EPISODE:$exx-">>$MythSExx/output.log
	echo "##############LISTING FOLDER PERMISSIONS#################">>$MythSExx/output.log
	echo "ORIGIONAL FILE>ls -l $3">>$MythSExx/output.log
	ls -l "$3">>$MythSExx/output.log
	echo "MythSExx WORKING DIR>lsmod -l $MythSExx/$NewShowName/">>$MythSExx/output.log
	ls -l "$MythSExx/$NewShowName/">>$MythSExx/output.log
	echo "MOVE DIR>lsmod -l $MoveDir/">>$MythSExx/output.log
	ls -l $MoveDir>>$MythSExx/output.log
	echo "ALTERNATE MOVE DIR> ls -l $AlternateMoveDir">>$MythSExx/output.log
	ls -l "$AlternateMoveDir/">>$MythSExx/output.log
	echo "#########################################################">>$MythSExx/output.log
	echo "####################END OF DEBUG LOG#####################">>$MythSExx/output.log
	echo "#########################################################">>$MythSExx/output.log
fi


#output format  showname=show name sxx=season number exx=episode number epn=episode name
ShowFileName=`echo "$NewShowName.$sxx$exx ($epn)"`

#check to see if episode information was obtained
if [ "$exx" != "" ]; then
#check to see if output folder exists
	if [ -d $MoveDir ]; then
		echo RESOLVED EPISODE INFORMATION: "$NewShowName: $epn = $sxx$exx">>$MythSExx/output.log
#If specified, make $movedir = $movedir/show name
		if [ "$UseShowNameAsDir" = "Enabled" ]; then
			MoveDir=`echo "$MoveDir"/"$NewShowName"`
#Make the folder if it does not exist
			if [ -d "$MoveDir" ]; then
				echo "VERIFIED FOLDER: $MoveDir">>$MythSExx/output.log
			elif [ ! -d "$MoveDir" ]; then
				echo "CREATING FOLDER: $MoveDir">>$MythSExx/output.log
				mkdir "$MoveDir"
#Error message if folder was not created
				if [ ! -d "$MoveDir" ];then
					echo "******PERMISSION ERROR COULD NOT CREATE $MoveDir/$NewShowName">>$MythSExx/output.log
			fi
		fi		
	fi
fi

#If file to be moved does not exist, then explain why	
if [ ! -f "$3" ]; then
	echo "****** INPUT FILE NAME NON EXISTANT CHECK INPUT FORMAT">>$MythSExx/output.log
fi

#If File exists, loop and add -$MythSExxCounter to the end of the file name
if [ -f "$MoveDir/$ShowFileName.$originalext" ]; then
	MythSExxCounter=0
	NameCheck="0"
	while [ $NameCheck = "0" ]; do
		let MythSExxCounter=$MythSExxCounter+1			

		if [ ! -f "$MoveDir/$ShowFileName-$MythSExxCounter.$originalext" ];then
			NameCheck="1"
			ShowFileName=`echo "$ShowFileName-$MythSExxCounter"`
		fi
	done
fi

#If symlink is not in LINK mode, Move and rename the file.
if [ $SYMLINK != "LINK" ]; then
	mv "$3" "$MoveDir/$ShowFileName.$originalext"

#Alternate Move dir used if original move dir does not work
	if [ ! -f "$MoveDir/$ShowFileName.$originalext" ]; then
		MoveDir=$AlternateMoveDir
		echo "COULD NOT CREATE FILE. USING ALTERNATE MOVE DIR: $AlternateMoveDir"
		mv "$3" "$MoveDir/$ShowFileName.$originalext"
	fi		
#If symlink is in LINK mode then create symlink
elif [ $SYMLINK = "LINK" ]; then
	ln -s "$3" "$MoveDir/$ShowFileName.$originalext"
fi 

#Check and report if file was moved
if [ -f "$MoveDir/$ShowFileName.$originalext" ]; then
	echo "@@@@@@@@@@@@@OPERATION COMPLETE" `date` "@@@@@@@@@@@@@@@">>$MythSExx/output.log
	if [ $SYMLINK = "MOVE" ]; then
		ln -s "$MoveDir/$ShowFileName.$originalext" "$3"
	fi
#send notification if enabled
 	if [ $Notify = "Enabled" ]; then
	sudo -S su "$NotifyUserName" alt-notify-send "MythSExx Sucess" "$ShowFileName moved to $MoveDir" info
	fi
	exit 0
#Failsafe mode. Failsafe will create a symlink.  Failsafe is always a operation failure.
elif [ ! -f "$MoveDir/$ShowFileName.$originalext" ]; then
	echo "ATTEMPTED MOVE:$3">>$MythSExx/output.log
	echo "TO:$MoveDir/$ShowFileName.$originalext">>$MythSExx/output.log
	echo "PERMISSION ERROR OR DRIVE FULL">>$MythSExx/output.log	
	if [ FailSafeMode = "Enabled" ]; then
		echo "ATTEMPTING SYMLINK TO FAILSAFE DIR: $FailSafeDir">>$MythSExx/output.log
		ln -s "$3" "$FailSafeDir/$ShowFileName.$originalext"
		if [ -f "$FailSafeDir/$ShowFileName.$originalext" ]; then
			echo "FAILSAFE MODE COMPLETE: SYMLINK CREATED">>$MythSExx/output.log
		fi
		if [ ! -f "$FailSafeDir/$ShowFileName.$originalext" ]; then
			echo "FAILSAFE MODE FAILURE CHECK PERMISSIONS IN $FailSafeDir">>$MythSExx/output.log
		fi
	fi
	echo "%%%%%%%%%%%%%OPERATION FAILURE" `date` "%%%%%%%%%%%%%%%%%">>$MythSExx/output.log
 #send notification if enabled
  	if [ $Notify = "Enabled" ]; then
	sudo -S su "$NotifyUserName" alt-notify-send "MythSExx Error" "Error moving $3 to $MoveDir/$ShowFileName" error
	fi
fi

#If move dir dosn't exist, then outpt it in the log
	elif [ ! -d $MoveDir ]; then
		echo "OUTPUT FOLDER $MoveDir DOES NOT EXIST">>$MythSExx/output.log
		echo "failure" `date`

#Log error if problem exists
echo mv "$3" "$MoveDir/$ShowFileName"
elif [ "$exx" = "" ]; then
	echo "NO MATCH FOUND.  TROUBLESHOOTING: Check www.TheTvDb TO SEE IF $1 EXISTS. ">>$MythSExx/output.log
	echo "CHECK $2. CHECK INTERNET CONNECTION. CHECK API KEY.">>$MythSExx/output.log
	echo "CHECK www.TheTvDb.com  RUN MythSExx LINK COMMAND PROMPT. FOR MORE INFORMATION SEE http://wiki.xbmc.org/index.php?title=MythSExx">>$MythSExx/output.log
	echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
#send notification if enabled
  	if [ $Notify = Enabled ]; then
	sudo -S su "$NotifyUserName" alt-notify-send "MythSExx error" "MythSExx Move operation failed See $MythSExx/output.log for more information" error
	fi
	exit 1 
fi

2 creating a rotating MythSExx library

The following is instructions for setting a dynamic library for XBMC

2.1 MythTV Settings

  • Click System/Administration MythTV Baclend setup
  • Select "1. General" then select next until you get to screen 3
  • Check "Follow symbolic links when deleting files".
  • Select next until you get to screen 8
  • Check "Allow user job #1 Jobs"
  • Select next until you get to screen 10
UserJob #1 Description: MythSExx
User Job #1 Command: /home/mythtv/MythSExx/MythSExx.sh  "%TITLE%" "%SUBTITLE%" "%DIR%/%FILE%"
  • Select Finish to exit
  • Select 6. Storage Directories
  • Select Default
  • Add a recording folder to which MythTV has access ie. /home/mythtv/Videos
  • Add additional folders if required.
  • Remove folders to which MythTV cannot run move jobs such as /lib or /var


3 Enabling Notifications

Notifications will occour at the end of every operation conducted by MythSExx. Notifications will let you know when it is time to update your XBMC Library.

3.1 Installing notify-send

Libnotify-bin contains the file which allows the terminal to send commands to the GNOME desktop.

  • open a terminal
apt-get install libnotify-bin


3.2 Setting permissions

The following procedure is a security risk, however unless a better way is found, this is the only way.

  • type the following
visudo
  • add the following line to visudo
%mythtv ALL=(ALL) NOPASSWD:ALL
  • save and exit

3.3 Enable Send to GNOME

To enable notifications to be sent to the desktop from a different user, you will need to use the alt-notify-send script.

  • place the following script in /usr/local/bin/

filename: alt-notify-send

#!/bin/bash
user=`whoami`
pids=`pgrep -u $user gnome-session`
title=$1
text=$2
timeout=$3

if [ -z "$title" ]; then
        echo You need to give me a title >&2
        exit 1
fi
if [ -z "$text" ]; then
         text=$title
fi
if [ -z "$timeout" ]; then
        timeout=60000
fi 

for pid in $pids; do
        # find DBUS session bus for this session
        DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
                /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
        # use it
        DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
        notify-send -u low -i $4 $timeout "$title" "$text"
done
  • Make it executable
sudo chmod +x /usr/local/bin/alt-notify-send
Personal tools
Namespaces

Variants
Actions
Navigation
Wiki help
Toolbox