Release myth2kodi -- generate Kodi friendly file-names from MythTV recordings.
#38
(2017-02-24, 17:10)jctennis Wrote: I went ahead and pulled the latest from github to test and it looks like you nailed it. Here is the output:
Code:
$ myth2kodi 1878_20170219010000.ts
DEBUG: ENTERING: log_rotation() ; CALLED FROM: m2k_init()
DEBUG: ENTERING: validate_settings() ; CALLED FROM: m2k_init()
DEBUG: myth2kodi script initialisation complete.
DEBUG: Running myth2kodi as mythtv
DEBUG: ENTERING: validate_args() ; CALLED FROM: main()
DEBUG: Called with 1 arguments. Called as:
       myth2kodi '1878_20170219010000.ts' "" "" "" '' ''
DEBUG: ENTERING: pre_process_check() ; CALLED FROM: validate_args()
       arg1: 1878_20170219010000.ts
DEBUG: Looks ok, FILE is named like a MythTV recording: 1878_20170219010000.ts
/usr/local/bin/myth2kodi: line 950: realpath: command not found
find: `': No such file or directory
find: `': No such file or directory
find: `': No such file or directory
find: `': No such file or directory
find: `': No such file or directory
find: `': No such file or directory
DEBUG: Arguments seem valid.
DEBUG: No command flag set. Processing as recording.
INFO: Processing: 1878_20170219010000.ts
DEBUG: ENTERING: process_mythtvdb() ; CALLED FROM: main()
DEBUG: ENTERING: get_mythtvdb_info() ; CALLED FROM: process_mythtvdb()
DEBUG: ENTERING: get_mythtvdb_info_pythonbindings() ; CALLED FROM: get_mythtvdb_info()
       m2kdir: /media/Storage/myth2kodi
       binpath: /usr/local/bin
       InputFileBasename: 1878_20170219010000.ts
       DBPin: 0000
       DBHostName: 192.168.1.78
       MySQLMythDb: mythconverg
       MySQLuser: mythtv
       MySQLpass: mythtv
       InputTitle:
       InputSubtitle:
       InputSeasonNum:
       InputEpisodeNum:
INFO: Accessing MythTV DataBase Using PythonBindings:
INFO: Attempting to pull database information on 1878_20170219010000.ts
DEBUG: Storing MythTV-DB info in temporary file: '/tmp/m2k_recinfo_2017-02-24T100355-mI5y'
mythdb_access: DEBUG:__main__:Establishing database connection
mythdb_access: DEBUG:__main__:Attempting to write data to file: /tmp/m2k_recinfo_2017-02-24T100355-mI5y
mythdb_access: DEBUG:__main__:Calling write_data()
mythdb_access: DEBUG:__main__:Operation complete.
mythdb_access: DEBUG:__main__:Closing out the file/stdout
DEBUG: Guide data as extracted by: get_mythtvdb_info_pythonbindings()
       chanid=1878
       starttime=2017-02-18 20:00:00-05:00
       endtime=2017-02-18 20:30:01-05:00
       title=Dragon Ball Super
       subtitle=How Dare You Do That to My Bulma! Vegeta's Metamorphosis of Fury!
       description=
       season=0
       episode=0
       category=Children
       hostname=tvserver-OptiPlex-760
       bookmark=0
       editing=0
       cutlist=0
       autoexpire=0
       commflagged=1
       recgroup=Default
       recordid=34
       seriesid=EP02576133
       programid=EP025761330007
       inetref=ttvdb.py_295068
       lastmodified=2017-02-21 02:42:03-05:00
       filesize=2208349520
       stars=0.0
       previouslyshown=0
       originalairdate=2017-02-18
       preserve=0
       findid=0
       deletepending=0
       transcoder=0
       timestretch=1.0
       recpriority=2
       basename=1878_20170219010000.ts
       progstart=2017-02-18 20:00:00-05:00
       progend=2017-02-18 20:30:00-05:00
       playgroup=Default
       profile=Default
       duplicate=1
       transcoded=0
       watched=1
       storagegroup=Default
       bookmarkupdate=2017-02-21 02:42:03-05:00
       recgroupid=1
       recordedid=1614
       inputname=5: MPEG2TS
       startdata[0]=0
       startdata[1]=22424
       startdata[2]=47035
       stopdata[0]=587
       stopdata[1]=30225
       stopdata[2]=54063
       xmltvgrabber=schedulesdirect1
DEBUG: Created a temporary comskip markupstart file: '/tmp/m2k_markupstart_2017-02-24T100355-V3Gx'
DEBUG: Created a temporary comskip markupstop file: '/tmp/m2k_markupstop_2017-02-24T100355-g5wx'
DEBUG: ENTERING: generate_comskip() ; CALLED FROM: get_mythtvdb_info_pythonbindings()
DEBUG: Created a temporary comskip markupframes file: '/tmp/m2k_markupframes_2017-02-24T100355-FHgZ'
DEBUG: COMMERCIAL DATA START:0 STOP:587
DEBUG: COMMERCIAL DATA START:22424 STOP:30225
DEBUG: COMMERCIAL DATA START:47035 STOP:54063
DEBUG: Not removing the temporary markup files: '/tmp/m2k_markupstart_2017-02-24T100355-V3Gx'; '/tmp/m2k_markupstop_2017-02-24T100355-g5wx'.
DEBUG: Setting the following variables based on MythTV-DB guide data:
       InputTitle=Dragon Ball Super
       InputSubtitle=How Dare You Do That to My Bulma! Vegeta's Metamorphosis of Fury!
       InputSeasonNum=0
       InputEpisodeNum=0
       ShowCategory=Children
       MovieAirDate=
       OriginalAirDate=2017-02-18
       StorageGroup=Default
       Stars=0.0
       Plot=
       LocalSeriesID=EP02576133
       ProgramID=EP025761330007
       ChanID=1878
       ShowStartTime=2017-02-18 20:00:00-05:00
       XMLTVGrabber=schedulesdirect1
DEBUG: Not removing the temporary MythTV-DB info file: '/tmp/m2k_recinfo_2017-02-24T100355-mI5y'
DEBUG: ENTERING: process_mythtvdb_schedulesdirect() ; CALLED FROM: process_mythtvdb()
INFO: Processing MythTV database info as SchedulesDirect.
DEBUG: Input and MythTV-DB guide data for 1878_20170219010000.ts
       RECSTART:2017-02-18 20:00:00-05:00
       DATE: 2017-02-18
       PROGRAMID:EP025761330007
       ShowCategory:Children
       InputTitle:Dragon Ball Super
       InputSubtitle:How Dare You Do That to My Bulma! Vegeta's Metamorphosis of Fury!
       Sxx: UNKNOWN
       Exx: UNKNOWN
       PLOT:
DEBUG: ENTERING: show_translation() ; CALLED FROM: main()
INFO: USER TRANSLATION: Dragon Ball Super = Dragon Ball Super
DEBUG: ENTERING: process_ignore_lists() ; CALLED FROM: main()
DEBUG: ENTERING: periodic_maintenace() ; CALLED FROM: main()
DEBUG: ENTERING: download_series_identification() ; CALLED FROM: main()
INFO: SEARCHING www.TheTVDB.com FOR Dragon%20Ball%20Super
DEBUG: Created a temporary zap2it file: '/tmp/m2k_zap2it_2017-02-24T100355-b1bk'
DEBUG: Not removing the temporary working file: '/tmp/m2k_working_2017-02-24T100355-ShGe'
DEBUG: ENTERING: get_serieslinenumber_zap2itid() ; CALLED FROM: main()
DEBUG: TESTING FOR ZAP2ITID MATCH: Dragon Ball Super
WARNING: get_serieslinenumber_zap2itid(): couldn't find serieslinenumber with Zap2itSeriesID
DEBUG: ENTERING: get_serieslinenumber_showname() ; CALLED FROM: main()
DEBUG: ENTERING: set_seriesid_newshowname_from_serieslinenumber() ; CALLED FROM: main()
INFO: FOUND:Dragon Ball Super ID#:295068 WITH CONFIDENCE:-1
DEBUG: ENTERING: make_m2k_database_dir() ; CALLED FROM: main()
DEBUG: ENTERING: check_m2k_database_up_to_date() ; CALLED FROM: main()
INFO: DATABASE MAINTAINED. Current: 1487948098. Next update: 1488134563.
INFO: Processing SeriesID:295068
DEBUG: ENTERING: set_absolute_episode_number_by_airdate() ; CALLED FROM: main()
WARNING: AIRDATE FAILED. TITLE MATCH ON ABSOLUTE EPISODE NUMBER:
DEBUG: ENTERING: set_absolute_episode_number_by_ename() ; CALLED FROM: main()
WARNING: AIRDATE/STANDARD LOGIC FAILED. FUZZY LOGIC ABSOLUTE: . Requiring doover.
DEBUG: ENTERING: set_absolute_episode_number_by_ename_fuzzy() ; CALLED FROM: main()
agrep: 2 words match within 8 errors
DEBUG: ENTERING: increment_total_matches() ; CALLED FROM: main()
DEBUG: TOTAL FUZZY LOGIC MATCHES:3943
DEBUG: TOTAL VERIFIED FUZZY ERRORS:79
DEBUG: ENTERING: set_sxxexx_absolute_episode_number() ; CALLED FROM: main()
INFO: EPISODE:How Dare You Hurt My Bulma Vegetas Total, Furious Change EPISODE NUMBER:9 S01E07 WITH CONFIDENCE: -2
DEBUG: PlotMatchFallback is Enabled
DEBUG: ENTERING: check_filesystem() ; CALLED FROM: main()
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 1110197
       arg 3 = /media/Storage/Videos
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 131947
       arg 3 = /home/mythtv/recordedTV
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 1110197
       arg 3 = /media/Storage/Movies
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 131947
       arg 3 = /home/mythtv/recordedMovies
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 1110197
       arg 3 = /media/Storage/recordedShows
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 2106
       arg 2 = 131947
       arg 3 = /home/mythtv/recordedShows
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 1
       arg 2 = 1110197
       arg 3 = /media/Storage/mythtv/recordings
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 5
       arg 2 = 1110197
       arg 3 = /media/Storage/myth2kodi
DEBUG: ENTERING: check_write() ; CALLED FROM: check_filesystem()
       Called with 3 arguments
       arg 1 = 5
       arg 2 = 131947
       arg 3 = /tmp
DEBUG: filesystem_write_state=0
DEBUG: ENTERING: msg_operation_summary() ; CALLED FROM: main()
INFO: ################ OPERATION SUMMARY ################
      JOB: myth2kodi '1878_20170219010000.ts' "" "" "" '' ''
       m2kVersion=myth2kodi Version 1.2.2c-
      CALLER=mythtv-
       m2kdir=/media/Storage/myth2kodi-
       Timeout=50-
       APIkey=3B054E548E3F4FBE-
      PROCESS_RECORDING_MODE=MOVE-
      SYMLINK=Enabled-
      TargetPathIsInputPath=Disabled-
      FailSafeMode=Disabled-
       FailSafeDir=/media/Storage/FailSafe-
       Notify=Disabled-
DEBUG: ENTERING: msg_dir_summary() ; CALLED FROM: msg_operation_summary()
      A summary table of writeable directories: 0='WRITEABLE' ; 1='NOT WRITEABLE'
      USER SETTING      |FLAG |Free Space  |Folder name
      m2kdir            |  0  | 1110197 MB | /media/Storage/myth2kodi
      M2K_TMPDIR        |  0  |  131947 MB | /tmp
      originaldirname   |  0  | 1110197 MB | /media/Storage/mythtv/recordings
      MoveDir           |  0  | 1110197 MB | /media/Storage/Videos
      AlternateMoveDir  |  0  |  131947 MB | /home/mythtv/recordedTV
      PrimaryMovieDir   |  0  | 1110197 MB | /media/Storage/Movies
      AlternateMovieDir |  0  |  131947 MB | /home/mythtv/recordedMovies
      PrimaryShowDir    |  0  | 1110197 MB | /media/Storage/recordedShows
      AlternateShowDir  |  0  |  131947 MB | /home/mythtv/recordedShows
      InputPath=1878_20170219010000.ts-
      InputTitle=Dragon Ball Super-
      InputSubtitle=How Dare You Do That to My Bulma! Vegeta's Metamorphosis of Fury!-
      InputSeasonNum=0-
      InputEpisodeNum=0-
      showtranslation=Dragon Ball Super-
      ShowName=Dragon Ball Super-
       LastUpdatedTVDB=1487869643-
       CurrentTimeTVDB=1487948098-
      SeriesID=295068-
      NewShowName=Dragon Ball Super-
       AbsoluteEpisodeNumber=9-
      EpisodeSubtitle=How Dare You Hurt My Bulma Vegetas Total, Furious Change-
      Sxx=S01- Exx=E07-
      MoveFileSize=2106 MB
      ConfidenceRating=-3-
      ConfidenceReasoning= Attempted Match On Zap2itID: Failed; Attempted match on Standard Logic: Successful; Attempted match on OriginalAirDate: Failed; Attempted SubTitle match on Standard logic: Failed; Attempted SubTitle match on Fuzzy logic: Successful; -
       XMLTVGrabber=schedulesdirect1-
      ShowStartTime=2017-02-18 20:00:00-05:00-
       MovieAirDate=-
       OriginalAirDate=2017-02-18-
      ProgramID=EP025761330007-
      ChanID=1878-
      StorageGroup=Default-
      ShowCategory=Children-
       GoForDoover=0-
      ProgramIDType=Series With Episode Data-
       rating=0-
      Zap2itSeriesID=2576133-
       LocalSeriesID=EP02576133-
      Plot=-
      Matched Plot=Beerus effortlessly disposes of Majin Boo, while Vegeta stands by in awe. Vegeta tries to persuade Beerus to calm down and enjoy himself, but he refuses to listen. Trunks and Goten fuse into Gotenks and attack to no avail. Powerless to do anything else, Gotenks starts insulting Beerus for which he is promptly punished. Piccolo, Tenshinhan, and Android 18 try taking on Beerus with little success. Majin Boo attacks again but is unable to land a single hit. While observing the battle, Dende realizes what Beerus actually is and immediately informs Piccolo. Before Piccolo is able to warn him, Gohan powers up and charges towards Beerus. Using Majin Boo as a weapon, Beerus repels Gohan, taking them both out. Being the last one standing, Vegeta confronts Beerus, but he is swiftly brought to the ground. Beerus tells Vegeta that he is disappointed with him that he is just as weak as his father was. Just as Beerus is about to finish Vegeta, Bulma walks up and slaps him for ruining her party. Beerus retaliates in similar fashion. Seeing Bulma struck infuriates Vegeta he explodes and powers up immensely. -
INFO: ################ END OF OPERATION SUMMARY ################
DEBUG: ENTERING: set_move_location() ; CALLED FROM: main()
DEBUG: Nothing to do here as Move dir is writeable, but cannot have an empty then and too tired to figure out how to rearrange the if block
DEBUG: ENTERING: set_show_file_name() ; CALLED FROM: main()
DEBUG: Naming as episode
INFO: Set file name as: Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change)
DEBUG: ENTERING: make_show_dir() ; CALLED FROM: main()
       NewShowName: Dragon Ball Super
       MoveDir: /media/Storage/Videos
       SeasonNumber: 1
       Notify: Disabled
       NotifyUserName: mythtv
       FailSafeDir: /media/Storage/FailSafe
INFO: CREATING SERIES FOLDER: /media/Storage/Videos/Dragon Ball Super
INFO: CREATING SEASON FOLDER: /media/Storage/Videos/Dragon Ball Super/Season 1
INFO: MOVE DIRECTORY SET AS: /media/Storage/Videos/Dragon Ball Super/Season 1
DEBUG: ENTERING: check_path_permission() ; CALLED FROM: main()
       PATH_TO_CHECK = 1878_20170219010000.ts
       REQUIRED_PERMISSION = rw
DEBUG: Checking 'rw' permissions for: 1878_20170219010000.ts
DEBUG: Good start: mythtv owns it.
DEBUG: Permissions ok for: 1878_20170219010000.ts
DEBUG: MOVING FILE: '1878_20170219010000.ts' to '/media/Storage/Videos/Dragon Ball Super/Season 1/Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change).ts'
INFO: Creating symlink in move mode.
DEBUG: ENTERING: success_postprocessing() ; CALLED FROM: main()
DEBUG: ENTERING: kodi_newshow() ; CALLED FROM: success_postprocessing()
       m2kScanMode:
       KODINotify: Enabled
       KODIUpdate: Enabled
       KODIIPs: 192.168.1.147:8080 ;.
       ShowName: Dragon Ball Super
INFO: Sending GUI.ShowNotification request to: 192.168.1.147:8080
DEBUG: SENT: GUI.ShowNotification for Dragon Ball Super
INFO: Sending VideoLibrary.Scan request to: 192.168.1.147:8080
DEBUG: SENT: VideoLibrary.Scan request.
DEBUG: ENTERING: add_undo() ; CALLED FROM: success_postprocessing()
       m2kdir: /media/Storage/myth2kodi
       InputPath: 1878_20170219010000.ts
       MoveDir: /media/Storage/Videos/Dragon Ball Super/Season 1
       ShowFileName: Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change)
       OriginalExt: ts
       PROCESS_RECORDING_MODE: MOVE
       SYMLINK: Enabled
DEBUG: ENTERING: add_doover() ; CALLED FROM: success_postprocessing()
       m2karg1: 1878_20170219010000.ts
       m2karg2:
       m2karg3:
       m2karg4:
       m2karg5:
       m2karg6:
       m2kdir: /media/Storage/myth2kodi
       InputPath: 1878_20170219010000.ts
       MoveDir: /media/Storage/Videos/Dragon Ball Super/Season 1
       ShowFileName: Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change)
       OriginalExt: ts
       RequiresDoover: 1
       PROCESS_RECORDING_MODE: MOVE
       SYMLINK: Enabled
INFO: Writing job to doover queue: /media/Storage/myth2kodi/doover.sh
DEBUG: ENTERING: dailyreport() ; CALLED FROM: success_postprocessing()
INFO: Writing to DailyReport file: 2017-02-24
DEBUG: ENTERING: generaterss() ; CALLED FROM: success_postprocessing()
ERROR: generaterss(): RSS generation failed: Directory not writeable (/var/www/myth2kodi-rss)
DEBUG: ENTERING: msg_completed_move() ; CALLED FROM: main()
INFO: Move completed.
      Moved: 1878_20170219010000.ts
      To: /media/Storage/Videos/Dragon Ball Super/Season 1/Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change).ts
      Added symbolic link from: 1878_20170219010000.ts
      To: /media/Storage/Videos/Dragon Ball Super/Season 1/Dragon Ball Super S01E07 (How Dare You Hurt My Bulma Vegetas Total, Furious Change).ts
DEBUG: ENTERING: exit_job() ; CALLED FROM: main()
       Called with 1 arguments
       arg 1 = MoveModeSuccessful
INFO: SUCCESSFUL COMPLETION TYPE: MoveModeSuccessful
DEBUG: Either: Notify=Disabled; scan mode; recording is in an ignore list; or NOTIFY_MSG was not set.
$

ETA: I just ran a scan on all my recording and myth2kodi found a bunch it must have missed before so I guess this fix helped out a lot!

Glad it is working better for you now...

From the log you posted, I noticed that your system does not have realpath installed, it is usually part of the package coreutils. So you should install that. It is installed by default on my system, but now that I know that that is not true for all systems I will add it as a dependency and check for it in diagnostics.

Also, out of curiosity, what percentage of your recordings are being moved successfully?
One way to figure it out, if you are in the default MOVE with SYMLINKing Enabled mode, is using something of the form:
Code:
ls -lS /path/to/recordings/directory/*.ext | less
where for you I think that means:
Code:
ls -lS /media/Storage/mythtv/recordings/*.ts | less
then, in less, jump to the end and then start scrolling back up until you reach the recordings showing symlinks and read the percentage down the bottom.

And another one out of curiosity, I noticed from your logs the other day that the MythTV-DB access takes a few seconds on your system, whereas on my test machine it's less than 1 second (5 year old machine, mid-range at purchase)... Is your MythTV-DB over a network from the machine running myth2kodi? The timing for the rest of the processing seems similar to what I get.

Thanks again for all the feedback.
Reply


Messages In This Thread
RE: myth2kodi -- generate Kodi friendly file-names from MythTV recordings. - by stuartk - 2017-02-25, 01:52
Logout Mark Read Team Forum Stats Members Help
myth2kodi -- generate Kodi friendly file-names from MythTV recordings.2