Kodi Community Forum
mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings (/showthread.php?tid=65644)



RE: mythicalLibrarian - billyx - 2013-07-02

Hello,

Have tried MythicalLibrarian today. I installed it using the Automatic Installation and this was a really bad idea! The first try produced much garbage and after using the Automatic installation there are different files of MythicalLibrarian with partially same contens, diferent names and different setting located on the HD. What a mess! Sad

After deleting all this and keeping only the file in the /usr/local/bin directory I was able to configure it manually, e.g. change the language. After some more tries of configuration and clean up I find at least one point of problem: The GetSeries.php call doesn't use the configured language. Confused

To fix this the line should be
curl -L -s -m"$Timeout" "http://www.thetvdb.com/api/GetSeries.php?language=$Language&seriesname=$tvdbshowname" > "$mythicalLibrarian/working.xml"

What still is not working:
- Some Episodes without subtitle are sorted to showings with a name containing ... S0E0 (Recordinginfo).mpg, others are sorted to episodes with the wrong name containing ... S09E01 () -7.mpg. In my opinion they should be all (where the episode id is identified) in episodes with the recording info in the name.
- Running the mythicalLibrarian two times in LINK mode produces two links with different names to the same file.


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - johnnyrevell - 2013-10-11

Was having some problems with r950 and stable with a programme called "The House that £100K Built"

error was:
Code:
Traceback (most recent call last):
  File "/usr/local/bin/MythDataGrabber.orig", line 274, in <module>
    writeData()    
  File "/usr/local/bin/MythDataGrabber.orig", line 228, in writeData
    else: f.write('%s = "%s"\n' % x)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 24: ordinal not in range(128)
The offending tuple x is (u'title', u'The House That \xa3100K Built'), and type(x[1]) is unicode

Problem seems to be Python sees the string as ascii but it's unicode, and an attempt to encode it into unicode is producing an error

I've changed from line 226 to read
Code:
#filter out unicode strings:
        if (type(x[1]) == str) or (type(x[1]) == unicode):
         try:
          f.write('%s = "%s"\n' % (x[0],x[1].encode('utf-8')))
         except:
          f.write('%s = "%s"\n' % (x[0],x[1].encode('ascii','ignore')))
        else: f.write('%s = "%s"\n' % x)
This traps the error by including unicode into the TRUE condition, then ignoring any unicode characters if encode('utf-8') throws an error


RE: mythicalLibrarian - varneyb - 2014-01-17

(2013-01-19, 08:17)outleradam Wrote:
(2013-01-17, 23:13)gthompson20 Wrote: ...
This section needs to be rewritten to use the new JSON RPS Interface as that is all that works in Frodo...
...

Added to the repository. Please test with SVN 950

I've looked at SVN 950, and the only change seems to be in the spaces; there appear to be no changes to use JSON...

Was any progress made on this?


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - Northern54 - 2014-01-19

I saw the same thing with SVN 950, so I rolled my own patch for my ubuntu system

1) copy below to /tmp/mythicalLibrarian.patch

2) cd /usr/local/bin

3) sudo patch < /tmp/mythicalLibrarian.patch

4) output should be patching file mythicalLibrarian



diff -Naur orig/mythicalLibrarian fix/mythicalLibrarian
--- orig/mythicalLibrarian 2014-01-18 18:13:43.000000000 -0500
+++ fix/mythicalLibrarian 2014-01-18 19:10:38.000000000 -0500
@@ -401,9 +401,10 @@
for XBMCIP in ${XBMCIPs[@]}
do
echo "SENDING REQUESTED COMMANDS TO:$XBMCIP"
- test "$XBMCNotify" = "Enabled" && curl -L -s -m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(mythical%20Librarian%2Cadding%20show%2​0$tvdbshowname%20to%20library))" > /dev/null 2>&1
- test "$XBMCUpdate" = "Enabled" && curl -L -s -m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))" > /dev/null 2>&1
- test "$XBMCClean" = "Enabled" && curl -L -s -m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(CleanLibrary(video))" > /dev/null 2>&1
+ test "$XBMCNotify" = "Enabled" && curl -L -s -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"mythical Librarian adding","message":"'$tvdbshowname'"},"id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+ test "$XBMCNotify" = "Enabled" && curl -L -s -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+ test "$XBMCNotify" = "Enabled" && curl -L -s -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"VideoLibrary.Clean","id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+
done
fi
return 0
@@ -1805,10 +1806,10 @@
for XBMCIP in ${XBMCIPs[@]}
do
echo "SENDING REQUESTED COMMANDS TO:$XBMCIP"
- XBMCcomm=`curl -L -s --connect-timeout 3 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(mythical%20Librarian%20Test%2CTesting%20Communication%20with%20mythicallibrarian))"|tr -d "</html>i^" `
+ XBMCcomm=`curl -L -s -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"mythical Librarian Test","message":"'$PythonBindingsCheck'"},"id":1}' http://$XBMCIP/jsonrpc|tr -d "\"</html>i^" `
test "$XBMCcomm" != "" && echo "TESTING:$XBMCcomm" || echo "COMMUNICATIONS NOT ESTABLISHED: $XBMCIP"
done
- test "`echo $XBMCcomm`" = "OK" && XBMCcomm="***PASSED***" || XBMCcomm="***FAILED***"
+ test "`echo $XBMCcomm`" = "{d:1,jsonrpc:2.0,resu:OK}" && XBMCcomm="***PASSED***" || XBMCcomm="***FAILED***"
echo "XBMC Communications $XBMCcomm"
read -n1 -p "Press any key to test file system permissions..."
echo ""


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - Northern54 - 2014-01-24

After fixing the issue with R950 and the missing JSON interface, found another issue with Frodo and some recordings not showing up in the library. The problem only occurred for shows that didn't have any episodes listed in TVDB, like a daily news show. I had this problem with CTV News.

When the library scan was running, this message showed up in the XBMC log file.

WARNING: No information found for item '/myth/recordings/Episodes/CTV News/', it won't be added to the library.

After looking into this, found that the NFO file created for the episode had a bad value. The first field needed to be episodedetails and not tvshow. Details on the layout for the episode nfo file are documented here.

http://wiki.xbmc.org/index.php?title=NFO_files/tvepisodes

This patch is for both issues.

To install this patch, just follow these steps

1) copy below to /tmp/mythicalLibrarian.patch

2) cd /usr/local/bin

3) sudo patch -l < /tmp/mythicalLibrarian.patch

4) output should be patching file mythicalLibrarian

PHP Code:
diff -tNaur orig/mythicalLibrarian fix/mythicalLibrarian
--- orig/mythicalLibrarian    2014-01-27 20:57:33.000000000 -0500
+++ fix/mythicalLibrarian    2014-01-27 20:03:54.000000000 -0500
@@ -401,+401,10 @@
                 for 
XBMCIP in ${XBMCIPs[@]}
                 do
                         echo 
"SENDING REQUESTED COMMANDS TO:$XBMCIP"
-                        test "$XBMCNotify"Enabled" && curl ---m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(mythical%20Librarian%2Cadding%20show%2​0$tvdbshowname%20to%20library))" > /dev/null 2>&1
-                        test "$XBMCUpdate"Enabled" && curl ---m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))" > /dev/null 2>&1
-                        test "$XBMCClean"Enabled" && curl ---m3 --connect-timeout 5 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(CleanLibrary(video))" > /dev/null 2>&1
+                        test "$XBMCNotify"Enabled" && curl ---m3 --connect-timeout 5 -X POST -"Content-Type: application/json" -'{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"mythical Librarian adding","message":"'$tvdbshowname'"},"id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+                        test "$XBMCNotify"Enabled" && curl ---m3 --connect-timeout 5 -X POST -"Content-Type: application/json" -'{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+                        test "$XBMCNotify"Enabled" && curl ---m3 --connect-timeout 5 -X POST -"Content-Type: application/json" -'{"jsonrpc":"2.0","method":"VideoLibrary.Clean","id":1}' http://$XBMCIP/jsonrpc > /dev/null 2>&1
+
                 
done
         fi
 
return 0
@@ -1500,+1501,@@
 
#Create an NFO file based upon extracted information
 
GenerateEpisodeNFO () {
         
test -"$MoveDir/$ShowFileName.nfo" && rm -"$MoveDir/$ShowFileName.nfo"
-        echo -"<tvshow>">>"$MoveDir/$ShowFileName.nfo"
+        echo -"<episodedetails>">>"$MoveDir/$ShowFileName.nfo"
 
         
if [ "$NamingConvention"" ] ; then
                 
if [ "$GoForDoover"1" ]; then
@@ -1517,+1518,@@
         echo -
"       <genre>$ShowCategory</genre>">>"$MoveDir/$ShowFileName.nfo"
         
test "$HasSxxExx"1" && echo -"    <season>$Sxx</season>" >>"$MoveDir/$ShowFileName.nfo" || echo -"      <season>0</season>">>"$MoveDir/$ShowFileName.nfo"
         
test "$HasSxxExx"1" && echo -"    <episode>$Exx</episode>">>"$MoveDir/$ShowFileName.nfo" || echo -"     <episode>0</episode>">>"$MoveDir/$ShowFileName.nfo"
-        echo -"</tvshow>">>"$MoveDir/$ShowFileName.nfo"
+        echo -"</episodedetails>">>"$MoveDir/$ShowFileName.nfo"
         
echo "'$MoveDir/$ShowFileName.nfo'" "'$MoveDir/$ShowFileName.$OriginalExt'">>"$mythicalLibrarian"/created.tracking
 
return 0
 
}
@@ -
1805,10 +1806,10 @@
         for 
XBMCIP in ${XBMCIPs[@]}
         do
                 echo 
"SENDING REQUESTED COMMANDS TO:$XBMCIP"
-                XBMCcomm=`curl -L -s --connect-timeout 3 "http://"$XBMCIP"/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(mythical%20Librarian%20Test%2CTesting%20Communication%20with%20mythicallibrarian))"|tr -d "</html>i^" `
+                
XBMCcomm=`curl -L -s -m3 --connect-timeout 5 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"mythical Librarian Test","message":"'$PythonBindingsCheck'"},"id":1}' http://$XBMCIP/jsonrpc|tr -d "\"</html>i^" `
                 
test "$XBMCcomm!= "" && echo "TESTING:$XBMCcomm|| echo "COMMUNICATIONS NOT ESTABLISHED: $XBMCIP"
         
done
-        test "`echo $XBMCcomm`" "OK" && XBMCcomm="***PASSED***" || XBMCcomm="***FAILED***"
+        test "`echo $XBMCcomm`" "{d:1,jsonrpc:2.0,resu:OK}" && XBMCcomm="***PASSED***" || XBMCcomm="***FAILED***"
         
echo "XBMC Communications $XBMCcomm"
         
read -n1 -"Press any key to test file system permissions..."
         
echo "" 



RE: mythicalLibrarian patches - GregoryK - 2014-01-24

@Northern54

thanks for the patches! But when I use your instructions to try to patch, I get the following output. I've checked and I'm running r950. Any tips on what to try next?

Code:
$ sudo patch < /tmp/mythicalLibrarian.patch
patching file mythicalLibrarian
Hunk #1 FAILED at 401.
Hunk #2 FAILED at 1500.
Hunk #3 FAILED at 1517.
Hunk #4 FAILED at 1805.
4 out of 4 hunks FAILED -- saving rejects to file mythicalLibrarian.rej



RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - Northern54 - 2014-01-28

Tks for the feedback, I just tried it myself by copying the code down from the site, and trying the patch and had the same issue. I took a deeper look and found a couple of issues with doing copy and paste, it had changed all the tabs to spaces and added an extra special character on 2 lines. So I created a new patch that changed the tabs to spaces, and updated the patch command to include -l ignore whitespace. For the extra special characters, I had to edit the patch before applying and remove an extraneous <200b> on lines 8 and 40. Line 8, should have only 1 <200b> and line 40 none.

Give it a try again.

patch -l --verbose --dry-run < /tmp/mythicalLibrarian.patch

The dry run option won't change anything


RE: mythicalLibrarian.patch - GregoryK - 2014-01-28

Hey thanks for the reply and for looking into it! I tried as you suggested, and got, well, halfway there?

Code:
$ patch -l --verbose --dry-run < /tmp/mythicalLibrarian.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -tNaur orig/mythicalLibrarian fix/mythicalLibrarian
|--- orig/mythicalLibrarian    2014-01-27 20:57:33.000000000 -0500
|+++ fix/mythicalLibrarian    2014-01-27 20:03:54.000000000 -0500
--------------------------
Patching file mythicalLibrarian using Plan A...
Hunk #1 FAILED at 401.
Hunk #2 succeeded at 1500.
Hunk #3 succeeded at 1517.
patch unexpectedly ends in middle of line
Hunk #4 succeeded at 1805 with fuzz 1.
1 out of 4 hunks FAILED -- saving rejects to file mythicalLibrarian.rej
done

Happy to try again or to try to track down the problem.

/GregoryK


JSON Handling - Northern54 - 2014-01-29

To make this easier for other people to access, I upload the patch file to the src repository under Issue #10. Downloading the patch from there will avoid all the copy/paste issues. Give it a try again.

https://code.google.com/p/mythicallibrarian/issues/detail?id=10&can=1

Hopefully one of the project admin's notice's this, and issue a new release.


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - GregoryK - 2014-01-29

Third time's a charm, that worked for me. I'll test it tonight but don't expect problems.

Adam (author & maintainer) shows as not having been on the site for almost a year, so I am not optimistic for a new release. I suppose I could try sending an email from his account page.

/GregoryK


RE: mythicalLibrarian .patch - GregoryK - 2014-01-31

@Northern54,

the patch is working fine on my mythbuntu 12.04 system, with the minor nitpick that when the XBMC notifications are triggered, spaces in the title show up as "%20"

/GregoryK


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - Northern54 - 2014-02-01

Ooops. I fixed the issue and updated the patch. Needs to be applied against the original version


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - fatmcgav - 2014-03-30

Hi all

Firstly, thanks for a great add on that helps integrate Mythtv and XBMC.

Have you thought about adding support for notifying Sickbeard about new recordings?

As I've got sickbeard setup to download TV progs, but I've also got mythtv recording stuff. It would be great if could avoid the overlap of recording and downloading the same progs.

Cheers
Gav


RE: mythicalLibrarian - a tool to build Movie and TV Show library from MythTV recordings - outleradam - 2014-05-29

Hey guys, If anyone would like to be added to the SVN to make changes, just let me know. I'm very active on Google+ and you can email me as well. (adam outler at gmail dot com)

I've switched to ChromeCast and ditched my cable television provider. If there are patches required, let me know, I will add you to the SVN so you can apply them.


Movies in Showings folder - se99paj - 2015-03-07

Hi guys, so just bought a Raspberry Pi and started playing around with OpenElec/Kodi as a frontend, I'm also using Mythtv as a backend to record everything.

I didn't like the way recordings were appearing on Kodi so thought I'd give mythicalLibrarian a try, I've managed to install without any issues, and I've configured the script and made the neccessary changes so any future recordings will automatically be covered by mythicalLibrarian. But I've hit upon a snag, not sure if its something that I'm doing wrong or if its setup incorrectly.

I've run a scan across a number of recordings, these recordings are then moved to 3 separate folder (Episodes/Movies/Showings)

The Episodes folder looks good, only tv shows appear here and they all appear in Kodi.
The movies folder is empty, there were a few movies in the scan but they didn't appear in this folder, how does the script determine if a recording is a movie?
The Showings folder contains movies and tv shows, it looks like tv shows without an episode number or season are appearing here.

If the Showings folder only contained tv shows I could just use the nfo file, but as this contains movies as well the movies aren't appearing in "Movies" section of Kodi.

I guess ultimately I'm trying to get tv shows in the "Tv Shows" section and movies in the "Movies" section.