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

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (/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 00:10

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. Frown

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 22:51

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 02:45

(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 02:30

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 05:16

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 06:09

@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 04:19

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 05:39

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 01:53

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 02:12

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 20:44

@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 22:22

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 00:07

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 18:06

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.