Recording freezing/stopping early - Hauppauge WinTV-HVR-955Q (2 Viewers)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    Note that the query I proposed is only suitable for MySQL, and only addresses movement of files. It does not address clean-up only.
    Thank you for that clarification. (y) I have my recordings stored in a folder tree residing in the "Videos" section. This allows me to arrange the recordings in a logical fashion, with multiple folder levels (i.e. nested folders). When I tried to do this with nested folders in "Recorded TV", the nested folders were ignored. :(

    I am not sure what the original poster wants to do -- move recordings to another disk defined as a "Recorded TV" location, or move recordings to the "Videos" section. But whichever he wants, he should write the tool to satisfy his requirements, not mine!

    -- from CyberSimian in the UK
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    This allows me to arrange the recordings in a logical fashion, with multiple folder levels (i.e. nested folders). When I tried to do this with nested folders in "Recorded TV", the nested folders were ignored. :(
    TV Server can arrange the recordings within nested folders on the file system if you define your recording file name format to include a relative structure (eg. %channel%\%title%\...). However, unlike the videos, music etc. sections, the recorded TV section within MediaPortal does not have a "shares view" (ie. a view that directly correlates with the file system structure). In some recorded TV views there are folders shown (eg. for grouping by channel, series, genre, record date), however those folders are entirely virtual.

    If you want to see the recordings in a shares view, you can simply add the base recording folder as a video share (or set the recording folder to be your video folder) and use the video section. What confuses me about your request is that this doesn't imply any need to move files or delete recordings from TV Server's database.
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    First, apologies to the original poster for going off-topic (again! :rolleyes:).

    TV Server can arrange the recordings within nested folders on the file system if you define your recording file name format to include a relative structure (eg. %channel%\%title%\...).
    For me, this does not provide enough granularity. I prefer to create a folder tree that subdivides recordings by subject. When I used WMC with the Microsoft EPG, my batch process would examine the genre in the recording's metadata, and move the recording to an appropriate folder in the folder tree. With the broadcast EPG that I now use with MP, the genres are mostly too vague to be useful, but I still arrange the recordings according to subject. Example ("N:" is my NAS drive):

    N:\Documentary\xxx\series_name\prog_name.ts
    N:\Entertainment\yyy\series_name\prog_name.ts
    N:\Interests\zzz\series_name\prog_name.ts

    where:
    "xxx" might be: "Current Affairs", "History", "Medicine", "Nature", "Science";
    "yyy" might be: "Comedy", "Drama", "Film";
    "zzz" might be: "Antiques", "Lifestyle", "Property", "Sport", "Travel".

    My batch process does not impose any limit on the nesting of folders, and I can move folders around in the tree without restriction when I decide that I want to re-organise things.

    What confuses me about your request is that this doesn't imply any need to move files or delete recordings from TV Server's database.
    What my batch process does is copy files from "Recorded TV" to the appropriate folders in "Videos". If the copy is successful, the original file in "Recorded TV" is then deleted. I have noticed the following:

    (1) The resume points for partially-watched recordings in "Recorded TV" are not preserved when the files are moved to "Videos".

    (2) I need to use the "Clean Up" function in "Recorded TV" to remove the now-deleted entries from the database.

    (3) The new files in a particular folder in "Videos" seem to be imported into the database the first time that I subsequently browse that folder (there is a noticeable pause and momentary "flickering" of the displayed programme info as MP works its way through the new files in the folder).

    I think that the need to update the database derives from my desire to arrange my recordings by subject. It is not obvious to me that MP could provide better support for this, other than (perhaps) a command-line tool for moving/copying/renaming/deleting files, something like:

    mpcmd.exe move "source_filespec" "target_filespec"

    -- from CyberSimian in the UK
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    For me, this does not provide enough granularity. I prefer to create a folder tree that subdivides recordings by subject.
    Okay. Well, TV Server can only act on the details that are available in the program meta-data. For what it's worth, to me both your documentary/entertainment/interests and xxx/yyy/zzz levels seem like genres. However TV Server only has capacity to store one genre per program/recording. So there's a bit of a gap between what you want and what's currently possible.

    What my batch process does is copy files from "Recorded TV" to the appropriate folders in "Videos". If the copy is successful, the original file in "Recorded TV" is then deleted.
    This does sound similar to what the OP is doing after all.

    (1) The resume points for partially-watched recordings in "Recorded TV" are not preserved when the files are moved to "Videos".
    That's because resume points are associated with the full file name/path. Moving the file changes the name and/or path. Therefore the resume point is lost. Nothing can be done about this.

    (2) I need to use the "Clean Up" function in "Recorded TV" to remove the now-deleted entries from the database.
    This is where I think you and the OP differ. The OP indicated they want to re-import the recordings so that the entries in recorded TV work after the underlying files have been moved. Nevertheless, you may be able to write a script that invokes the MySQL command line client with a query to delete all recording entries that have been moved. A query such as DELETE FROM Recording WHERE LOAD_FILE(fileName) IS NULL; may work. However it may be veeeery sloooooooow. Unfortunately there doesn't seem to be any direct "does file exist" function available. I think you'd be much better off with a solution that involves more code/logic.

    (3) The new files in a particular folder in "Videos" seem to be imported into the database the first time that I subsequently browse that folder (there is a noticeable pause and momentary "flickering" of the displayed programme info as MP works its way through the new files in the folder).
    MP is probably generating thumbnails for the new videos. If you copied the recording thumbnail over when you move the recording itself then I suspect this wouldn't happen.

    I think that the need to update the database derives from my desire to arrange my recordings by subject. It is not obvious to me that MP could provide better support for this, other than (perhaps) a command-line tool for moving/copying/renaming/deleting files, something like:

    mpcmd.exe move "source_filespec" "target_filespec"
    It is possible to write such scripts for moving, deleting and renaming individual recordings when source and target file names/paths are provided. The point when it becomes more challenging is when you're working with more than one file and/or incomplete information. For example: the generalised clean-up function. If you could tell the script which entries need to be cleaned up then it becomes possible again.

    Here are some batch scripts that may give you some ideas.

    rename/move:
    Code:
    @echo off
    set source=%1%
    set target=%2%
    
    echo UPDATE Recording SET fileName = %target% WHERE fileName = %source%; > temp.sql
    "c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -h host_name -D database_name -u user_name -ppassword < temp.sql
    del temp.sql
    
    move %source% %target%

    delete:
    Code:
    @echo off
    set target=%1%
    
    echo DELETE FROM Recording WHERE fileName = %target%; > temp.sql
    "c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -h host_name -D database_name -u user_name -ppassword < temp.sql
    del temp.sql
    
    del %target%

    Note...
    • if you don't have a MySQL database then these scripts won't work, but it's almost certainly possible to write equivalent scripts for your database
    • the path to your mysql.exe may vary
    • you should replace host_name, database_name, user_name and password with appropriate credentials for your database
    • when you run the scripts, arguments should be wrapped in quotation marks and back-slashes must be escaped; for example: mpmove "e:\\my recording folder\\a recording.ts" "f:\\a video folder\\a sub-folder\\a recording.ts"
    Disclaimer
    These scripts can delete files, contain plaintext passwords, and do not check the inputs are sane/safe. As such they are somewhat dangerous. I urge extreme caution if you decide to use them. Also, I do not take any responsibility for any consequences arising from their use.
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,873
    1,801
    Southampton
    Home Country
    United Kingdom United Kingdom
    MP is probably generating thumbnails for the new videos. If you copied the recording thumbnail over when you move the recording itself then I suspect this wouldn't happen.
    Actually, I have thumbnails switched off :eek:, as I am not a fan of "eye candy"; I much prefer words. Also, thumbnails for recordings are often not apposite (as distinct from DVD covers, where the cover thumbnail usually is appropriate). Having said that, I was looking at an MP log file a few days ago, and I noticed some entries for "thumbnail generation", so perhaps I have not disabled thumbnails in enough places. :(

    It is possible to write such scripts for moving, deleting and renaming individual recordings when source and target file names/paths are provided. The point when it becomes more challenging is when you're working with more than one file and/or incomplete information.
    My batch process handles the files one by one, and always has the fully-resolved filespec available (both for source and target). But then I am a programmer. Whether the original poster would be able to do this in his batch process is unclear.

    Thank you for the SQL examples. I have never knowingly used SQL, so this will be something new to learn. My MP database originates from MP 1.9 pre, which was... MSSQL? I have not updated it on subsequent MP upgrades, as that is the part of the installation that always goes wrong. :cry:

    -- from CyberSimian in the UK
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    My MP database originates from MP 1.9 pre, which was... MSSQL?
    Not necessarily. People have been able to use either MySQL or SQL Server ("MSSQL") with TV Server for many years (since before 2010).
     

    Users who are viewing this thread

    Top Bottom