MythTV XBMC renamer. - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: MythTV XBMC renamer. (/showthread.php?tid=63006) |
MythTV XBMC renamer development thread - outleradam - 2009-12-01 This development thread is obsolete please see this thread: http://forum.xbmc.org/showthread.php?p=453344 This is something I've been working on tonight. I hope to have it operational soon. It will eventually rename episodes to Showname-SxxExx-(show title).XXX with only the showname and episode name from MythTv. Usage: /user/home/Desktop/tv.sh "showname" currently it will generate a file called "show name".txt which is the entire TVDB on the show and "show name".reduced.txt which contains only the pertinant information Code: #/bin/sh would anyone like to give me input? I'm learning bash - outleradam - 2009-12-01 This version will output a file with showname Ex Sx Code: #/bin/sh - outleradam - 2009-12-01 I could really use some help to rearrange the output from my program. It is currently generating a file like this: Code: tv.sh "family guy" Code: Season 4 DVD Extra - Outtakes E24 S0 I need it to output 2 digits like: Sxx and Exx instead of Sx Ex - outleradam - 2009-12-01 got double digits up and am now working on matching the showname to the Exx Sxx I don't know what I'm doing wrong on that.. Code: #/bin/sh to do: make it thetvdb friendly get output from file write XBMC regex ohgod i hope xexe will help me. ... future: add alternate lookup by date and other search engines. - theophile - 2009-12-01 I've put together a script that takes as its argument the show name and episode name, then it queries the MythTV database for the stored file name, runs a custom command on that file (usually commercial cutting and transcoding), then places the output file in my XBMC TV shows directory and a supdirectory based on the show name, and names the output file "Show.SxxExx.Episode.mkv". It queries TVDB based on the episode's original airdate to determine the season and episode numbers. You can check it out here: http://monopedilos.com/dokuwiki/doku.php?id=hdpvrcutter.pl - outleradam - 2009-12-02 MWhy didn't you post that with better directions earlier? I went looking for instructions all over and I could not figure out how to use that. I programmed my own because your instructions are so vauge. What package are those dependencies in? I still can't figure out how to use that program. Here's my script. It does not have handling yet. It works though. Just need to bypass things on errors. Code: #/bin/sh It works with curl. All that's left is error handling and making it a plugin for the official tvrenamer script included with myth. - theophile - 2009-12-02 outleradam Wrote:MWhy didn't you post that with better directions earlier? I went looking for instructions all over and I could not figure out how to use that. I programmed my own because your instructions are so vauge. What package are those dependencies in? I still can't figure out how to use that program.I provided much more detailed instructions than 9 out of 10 bash/perl/pythin scripts on the net. As for packages, I don't know what distro you are using and chances are that if you don't know how to find and install software on your own distro, you're probably not going to be able to use it anyway. So all that to say, you're welcome and best of luck. - outleradam - 2009-12-03 theophile Wrote:I provided much more detailed instructions than 9 out of 10 bash/perl/pythin scripts on the net.No, most scripts list dependencies as you can install them. You should just put in full directions for a person to use your software. You should also list information about the OS required to install it otherwise people like me, last week, come along and look at it like WTF? Me after 4 hours screwing with it: "This guy admitted not knowing how to program.. why did I waste my time working with this script if I knew it was not going to work in the first place." Your program did do something. I just can't tell what it was. I gave it the information, and it rearranged my files. Your program moved my files around, but did not get the information. Quote:As for packages, I don't know what distro you are usingUbuntu 9.11 Quote:and chances are that if you don't know how to find and install software on your own distro Sure I do... full installation instructions are to follow... Bash installation $> 1. type sudo apt-get install curl (run through the installation) 2. copy the program to any folder of your choosing and which your myth user name has rights to read and write to files, this is because BashSxxExx will maintain it's own text-file database for quick reference. 3. ****Implementation into mythrename is not complete yet.*** Quote: you're probably not going to be able to use it anyway. So all that to say, you're welcome and best of luck.Why am I not going to be able to use it? Thank you. For those of you watching or waiting for this project, The above will output a name, but only if it is absolutely correct. My latest work now has that corrected, however if you type 'the' as the showname it will recognize all shows that come up with 'the'. so my todo list before this is "ready" is the following. I'm going to have it go through and download every XML for the returned SID returned by theTvDb until it obtains an exact match. I'm currently working on a database maintenance routine which will avoid excessive downloading unless theTvDb has updated that particular show Also in the works soon to come: a separate text file which will look for specific names from your tvguide and rename them for theTvDb: IE. Aqua Teen Hungerforce = Aqua Teen Hunger Force. The official name for this project is BashSExx - outleradam - 2009-12-03 sigh, i've been troubleshooting my program because it was not working and then I realized that theTvDb.com is down right now. That is note worthy as a log note on a failure. got some work done in the right direction, however, thetvdb is down right now so there's alot of errors Code: #/bin/sh - theophile - 2009-12-03 outleradam Wrote:No, most scripts list dependencies as you can install them. You should just put in full directions for a person to use your software. You should also list information about the OS required to install it otherwise people like me, last week, come along and look at it like WTF? Me after 4 hours screwing with it: "This guy admitted not knowing how to program.. why did I waste my time working with this script if I knew it was not going to work in the first place." Your program did do something. I just can't tell what it was. I gave it the information, and it rearranged my files. Your program moved my files around, but did not get the information.It's a perl script. There are two ways to tell. The first is that it has a .pl extension. The second is that the first line of the script tells you as much. It's OS-agnostic as long as you have a perl interpreter on your system. Since MythTV is a Linux project, I felt it was unnecessary to specify that it was written on Linux. I specified what the dependencies are. Short of giving you the apt-get lines, I don't see what more you could want. You should be able to figure out how to install mythtv, avidemux, and a perl module. As for what it does, my intial post in this thread explained what the script does. The first paragraph on the wiki explains what it does. Moreover, you can see the entire script. Again, what do you want? This script has been posted on this forum before and has been posted on the MythTV mailing list for 6 months and no one has ever complained before. I don't know what your problem is, but try to be a little less of a douchebag when someone offers you something. - outleradam - 2009-12-03 Sorry, I will try to make my future posts nicer. I will use smileys. I saw that your post used perl and I did not have perl. So then I typed apt-get install perl After that I viewed the code and I figured out that I needed to change settings. so I did Code: $recordings_dir = '/var/lib/mythtv/recordings'; - outleradam - 2009-12-03 Then I set up a job as hdpvrcutter %TITLE% %SUBTITLE% Then I went to the webadmin and started the job on a file I had recorded and it changed the name, but not to what I wanted So then I tried again and it did some file operation So then I went through the code and added debug lines for logging purposes to find out what was going wrong even though I don't know perl Then I changed ownership and permissions to the myth home dir to 777 make hdpvrcutter work then I tried changing permissions to 777 for the myth recording dir. - outleradam - 2009-12-03 Then I moved the hdpvr cutter from mythtv to the file dir and I reset the job as ../hdpvrcutter title subtitle again. Then I tried running the job manually Then I tried running the job manually as root Then after 4 hours I gave up sorry, i had to split the post up because there were too many smileys. - theophile - 2009-12-03 outleradam Wrote:The above will output a name, but only if it is absolutely correct.The reason I used perl for my script instead of bash is primarily because someone on the Mythbuntu forum wrote a metadata script for TVDB that uses a Levenshtein distance analysis for matching show and episode name string between the input and the TVDB query results. The result is that it's 100% accurate even with minor to moderate variations in name. I also opted for the GetEpisodeByAirdate.php route because I didn't want it downloading and parsing xml files. While I'm sure there are advantages to that approach, you've already stumbled onto one of the disadvantages: figuring out how to manage a local "database" of TV show information. The downside to my approach is that it can't tell the difference between two different episodes that originally aired on the same day. I decided that this was a rare enough eventuality that I didn't mind fixing those few occurrences by hand. Now, to the real point, my script is designed to transcode MythTV recordings, but it would be trivial to have it simply rename them or create symlinks. In that case, the only dependency (besides Perl, obviously) would be the LWP::UserAgent module. Avidemux, the mythcommflag patch, and mkvtoolnix are only used for the transcoding process. If you want to do that, I'd be happy to help provided you quit being so hostile. If you want to stick to your approach (which you have a very good start on), by all means. One little suggestion would be to have it check for the existence of the showname subdirectory and if it doesn't exist, create it. Bad things happen if you run the script without the directory already being present. - theophile - 2009-12-03 outleradam Wrote:Then I moved the hdpvr cutter from mythtv to the file dir and I reset the job as ../hdpvrcutter title subtitle again. Then I tried running the job manually Then I tried running the job manually as root Then after 4 hours I gave upAs I'm sure you are aware, console output is necessary for debugging a script. What do you get on the command line when you run: Code: ./hdpvrcutter "Show Name" "Episode Name" |