Archive:MythicalLibrarian UserJobs: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Outleradam
No edit summary
>Outleradam
Line 17: Line 17:
Only one of these jobs will be run by mythicalLibrarian before it exits.  
Only one of these jobs will be run by mythicalLibrarian before it exits.  


=== Variables for use ===
=== Variables for use in user jobs ===
The following variables can be used in any user job.
 
ALL RECORDINGS
$MoveDir/$ShowFileName.$originalext = location of moved file.
$ShowName = Processed Title
$InputTitle = actual database title
$MoveDir = the folder to which the file was moved ie. "/home/mythtv/videos/Episode"
$ShowFileName = the name of the show moved, not including extension eg. "simpsons S01E02 (foo)" or "MovieTitle(year)"
$originalext = original file extension  eg "mpg"
$NewShowName = Successfully resolved show name
$ChanID = ChannelID
$ProgramID= Zap2it listing
$ShowStartTime = begin recording time
$ShowCategory = category like children or sports
$mythicalLibrarianProgramIDCheck = "SH" for SHow or sports - "MV" for MoVie - "EP" for EPisode
$plot = plot
$stars = stars
$FileBaseName = name of the file to be moved without ext
$XMLTVGrabber = your guide data type
$ProgramIDType= Generic episode with no data, Movie, or Series With Episode Data
$Zap2itSeriesID= Zap2it ID with SH, MV or EP stripped
$MyUserName = name of user running mythicalLibrarian
$SafeShowName = title of show after showtranslations formatted for filesystem use
 
EPISODES AND GENERIC SHOWS
$OriginalAirDate = original air date  Generic programming will be the first episode ever, for episodes it will be the first aired date
$epn = Subtitle or EPisode Name
 
EPISODES
$exx = Episode Number or "Movie" in case of a movie
$sxx = Season number or blank in case of movie
$seriesid = TheTVDB series ID
$TvDbTime = current tvdb time
$LastUpdated = last updated time (for Episodes only others wil be blank)
$absolouteEpisodeNumber = tvdb order numbering
 
####MOVIES####
#$MovieAirDate = the original year the movie aired
Depending on the recording, different variables will be available. Unused variables will be blank.


=== Example ===
=== Example ===

Revision as of 03:04, 19 September 2010

mythicalLibrarian UserJobs

mythicalLibrarian has incorporated user jobs to allow users to expand mythcialLibrarian to suit their needs without having to worry about loosing their changes when upgrading. User jobs are bash code which run at the end of mythicalLibrarian. Everything which mythicalLibrarian does can be undone or redone using user jobs and a bit of wit.

user jobs are a part of mythicalLibrarian

during mythicalSetup (aka mythicalLibrarian --update), the latest version of mythicalLibrarian is downloaded. mythicalSetup separates the code portion of the script from the user portion of the script. Think of the code portion as unmaintainable and dynamic from a user perspective, that is, it will change frequently. mythicalSetup then asks a series of questions and makes decisions based on your computer's setup. The final step before actually inserting the code into your user portion is to insert the user jobs.

Job Files

You will normally only want to script the JobSucessful job. However, the user jobs are as follows

  • /etc/mythicalLibrarian/JobSucessful -Is run when mythicalLibrarian completes in the most appropriate manner
  • /etc/mythicalLibrarian/JobInformationNotComplete -Is run when mythcalLibrarian determines there was not sufficient information to name the file according to standards. This type of job occurs when mythicalLibrarian attempts to rename by season and episode, but cannot obtain the information from TheTvDb. This is also accompanied by a spot in the --doover job file.
  • /etc/mythicalLibrarian/JobFilesystemError - Is run when mythcialLibrarian detects that it does not have proper permissions on one or more of the required folders.
  • /etc/mythicalLibrarian/JobInsufficientData - Is run in place of JobInformationNotComplete when the user elects not to process shows without required information. AKA. Showstopper.
  • /etc/mythicalLibrarian/JobIgnoreList - Is run when the user elects to ignore a show based on category or Title.
  • /etc/mythicalLibrarian/JobGenericError - Is run when mythicalLibrarian is not given enough information and has no TV Recording database to work with
  • /etc/mythicalLibrarian/JobUnspecified - This job should never be run unless you are debugging. It is called when RunJob is called in mythicalLibrarian and there is no JobType variable set.

Only one of these jobs will be run by mythicalLibrarian before it exits.

Variables for use in user jobs

The following variables can be used in any user job.

ALL RECORDINGS

$MoveDir/$ShowFileName.$originalext = location of moved file.
$ShowName = Processed Title
$InputTitle = actual database title
$MoveDir = the folder to which the file was moved ie. "/home/mythtv/videos/Episode"
$ShowFileName = the name of the show moved, not including extension eg. "simpsons S01E02 (foo)" or "MovieTitle(year)"
$originalext = original file extension  eg "mpg"
$NewShowName = Successfully resolved show name
$ChanID = ChannelID
$ProgramID= Zap2it listing
$ShowStartTime = begin recording time
$ShowCategory = category like children or sports
$mythicalLibrarianProgramIDCheck = "SH" for SHow or sports - "MV" for MoVie - "EP" for EPisode
$plot = plot
$stars = stars
$FileBaseName = name of the file to be moved without ext 
$XMLTVGrabber = your guide data type
$ProgramIDType= Generic episode with no data, Movie, or Series With Episode Data
$Zap2itSeriesID= Zap2it ID with SH, MV or EP stripped
$MyUserName = name of user running mythicalLibrarian
$SafeShowName = title of show after showtranslations formatted for filesystem use

EPISODES AND GENERIC SHOWS

$OriginalAirDate = original air date  Generic programming will be the first episode ever, for episodes it will be the first aired date
$epn = Subtitle or EPisode Name

EPISODES

$exx = Episode Number or "Movie" in case of a movie
$sxx = Season number or blank in case of movie
$seriesid = TheTVDB series ID
$TvDbTime = current tvdb time
$LastUpdated = last updated time (for Episodes only others wil be blank) 
$absolouteEpisodeNumber = tvdb order numbering
####MOVIES####
#$MovieAirDate = the original year the movie aired

Depending on the recording, different variables will be available. Unused variables will be blank.

Example

The following is an example which transcodes a file


/etc/mythicalLibrarian/JobSucessful

#Run a transcoding program on the file
ffmpeg -i S:"$MoveDir/$ShowFileName.$originalext" -target ntsc-svcds:"$MoveDir/$ShowFileName.mp4"

#Write the new file extension over the old extension for logging
originalext=mp4 

#Run logging for the new file extension so mythicalLibrarian can keep track of files it created.
performLoggingForMoveMode #or performLoggingForLinkMode
 
#remove the mythicalLibrarian symlink
rm "$InputPath"

#make a new symlink
ln -s  "$MoveDir/$ShowFileName.originalext" "$InputPath"

#Enable XBMC Communications which were disabled so mythicalLibrarian did not communicate when the command was called before
XBMCUpdate=Enabled
XBMCClean=Enabled
XBMCNotify=Enabled

#Tell mythicalLibrarian to send a message to XBMC and update the library
XBMCAutomate

#Don't exit, just let mythicalLibrarian take back over.

See Also