[solved] - Export tool and import support from MP-TVSeries & Moving Pictures to MP2

Discussion in 'Feature Requests' started by raffe, February 10, 2019.

  1. raffe

    raffe Portal Pro

    Joined:
    March 28, 2008
    Messages:
    211
    Likes Received:
    35
    Ratings:
    +44 / 0
    Show System Specs
    *************************************************
    EDIT 2019-04-29: New version, see Gitlad for change log. Thank you SINCowboy

    So I took your advice and my ancient developer skills to make this tool:
    Files · master · Raffe / MPTVSeries and MovingPictures to MP2 · GitLab

    I think we all are surprised that it actually seems to work. If anyone else need a tool like this, try it. If it has errors, and it probably has, you are free to improve it :)

    For info about what it does, read the README.md, the posts under or just test it.

    I have tried to follow the picture and nfo guidelines here:
    NfoMovieMetadataExtractor
    NFO Node - Lexical support
    TV-Show artwork - Official Kodi Wiki
    NFO files/TV shows - Official Kodi Wiki

    For TV series it works best if you have:
    1. One folder for each TV series, eg. maybe "The.Blacklist"
    2. In the TV series folder you have one folder for each seson, eg. maybe "S01"

    I also recommend using Trakt.

    This tool will not alter any media files. It will make .nfo files and copy pictures from Moving Pictures and MPTVSeries to their media folders.

    These .nfos and pictures may make it easier to move from MP1 to MP2.



    You need to have this software on a computer that can find both the MP1 files and the media folders. You also need to have sqlite3_x64.dll in the same folder as the application.

    If, or probably when, you get problems. Check the content of the database, maybe with the tool here: DB Browser for SQLite

    Some examples: Is the filename to long in database (more than 260 char)? Do the online_series have empty rows? Etc...

    Also check the folder, do the files have the right name, season & episode etc? Check with www.thetvdb.com.

    If nothing helps, maybe you need to install autoit and make your own error checks in the code. You may find some Media Portal help in this forum:
    MediaPortal 2 | MediaPortal HTPC

    You should find the source here:
    Files · master · Raffe / MPTVSeries and MovingPictures to MP2 · GitLab

    And some Autoit help in this forum: AutoIt Help and Support

    /raffe

    Some screenshots.

    Moving Pictures Create Mode
    [​IMG]
    Moving Pictures Delete Mode
    [​IMG]
    Moving Pictures In Action
    [​IMG]
    TV-Series Create Mode
    [​IMG]
    TV-Series Delete Mode
    [​IMG]
    TV-Series In Action
    [​IMG]

    *************************************************

    Hi!

    I am struggling in my efforts to go from MP1 to MP2. The problem is that I have used MP1 for a long time and now have 2992 movies (some normal (maybe 2300), some obscure that are not in IMDB, some homemade) and 439 series (some normal (maybe 350), some homemade, some educational like PhotoShop courses) with about 12103 episodes.

    If there was an export tool, to get info from MP-TVSeries & Moving Pictures databases and picture folders, and import support from that export to MP2, when I have MP1 and MP2 on the same PC (all databases and pictures on same PC), it would help tremendously as a start with getting everything into MP2.

    When I have tried to go from MP1 to MP2, last time with MP2.2, I have first used MovPicNFO (edit: not this; MovingPictures Import Export GUI ) to get "XML files containing all of the movie information and local media settings, as well as watched settings and custom filter (black / white), list settings" to the movie folder. "It will also copy all related cover art (cover, thumb, alternate covers, and backdrop)" to the movie folder. But it don't seem to work better when importing to MP2, I still have 30% of the children movies (a smaller movie folder) without pictures, and I still have very many series and episodes that don't work with this tool, left to get into MP2.

    If there was a tool like "MovPicNfo" for both MP-TVSeries & Moving Pictures and support on MP2 to use this info to first populate the MP2 database, it would make everything much more easy. If the tool can't help with EVERYTHING, say I still have 100+ movies and 5 series to do manually (maybe there is a log where I can see problems), it would still be much less work. I would also guess this would make it easier for more people than me to migrate to MP2 and the first import maybe would go faster.

    The files I get with the tool today looks something like this:
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.avi, this is just the movie. In the same folder as the movie is in, I get these files with the tool:
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.imdbid.txt contains
    Code (Text):
    1. tt0472033
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.nfo contains
    Code (Text):
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <movie>
    3.   <title>9</title>
    4.   <sorttitle>9</sorttitle>
    5.   <originaltitle>|9|Número 9|#9|9 - A Salvação|Devetka|Nueve|Numéro 9|</originaltitle>
    6.   <rating>5.9</rating>
    7.   <year>2009</year>
    8.   <plot>A rag doll that awakens in a post-apocalyptic future holds the key to humanity's salvation.</plot>
    9.   <tagline>(5) To Guide Us...</tagline>
    10.   <runtime>79</runtime>
    11.   <mpaa>PG-13</mpaa>
    12.   <language>English</language>
    13.   <id>tt0472033</id>
    14.   <director>|Shane Acker|</director>
    15.   <studios>|Focus Features|</studios>
    16.   <watched>True</watched>
    17.   <genre>Animation</genre>
    18.   <genre>Action</genre>
    19.   <genre>Adventure</genre>
    20.   <genre>Fantasy</genre>
    21.   <genre>Mystery</genre>
    22.   <genre>Sci-Fi</genre>
    23.   <genre>Thriller</genre>
    24.   <actor>
    25.     <name>Christopher Plummer</name>
    26.   </actor>
    27.   <actor>
    28.     <name>Martin Landau</name>
    29.   </actor>
    30.   <actor>
    31.     <name>John C. Reilly</name>
    32.   </actor>
    33.   <actor>
    34.     <name>Crispin Glover</name>
    35.   </actor>
    36.   <actor>
    37.     <name>Jennifer Connelly</name>
    38.   </actor>
    39.   <actor>
    40.     <name>Fred Tatasciore</name>
    41.   </actor>
    42.   <actor>
    43.     <name>Elijah Wood</name>
    44.   </actor>
    45.   <actor>
    46.     <name>Alan Oppenheimer</name>
    47.   </actor>
    48.   <actor>
    49.     <name>Tom Kane</name>
    50.   </actor>
    51.   <actor>
    52.     <name>Helen Wilson</name>
    53.   </actor>
    54.   <writer>
    55.     <name>Pamela Pettler</name>
    56.   </writer>
    57.   <writer>
    58.     <name>Shane Acker</name>
    59.   </writer>
    60. </movie>
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.WatchStatus.xml contains
    Code (Text):
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <movie>
    3.   <watched>True</watched>
    4. </movie>
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD_cover.jpg (cover picture)
    9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD_fanart.jpg (fan art picture)

    This is an example on what the tool do, but a new tool maybe
    1. Only need to create one XML file and the pictures.
    2. Would be nice with an error log, that gives a back log with info about which files I need to work manually with.
    3. Also, if every file that the tool creates also contains unique characters in the file name, they could easily be deleted when they are not needed anymore. E.g. say the filenames would look like this:
      9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.avi
      9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.MP2SuperToolVer00123.nfo.txt
      9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.MP2SuperToolVer00123.cover.jpg
      9.2009.(7.1AnimationAdventureDramaFantasySci-Fi)DVDRiP.AC3.XViD.MP2SuperToolVer00123.fanart.jpg
    /raffe
     
    Last edited: April 29, 2019
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. HTPCSourcer
    • Team MediaPortal
    • Administrator

    HTPCSourcer MP2 Product Manager

    Joined:
    May 16, 2008
    Messages:
    10,453
    Likes Received:
    1,103
    Gender:
    Male
    Ratings:
    +2,366 / 21
    Home Country:
    Germany Germany
    Show System Specs
    Hello @raffe ,

    The way to go would be to create nfo information on your current basis. This can then be imported instantaneously by MP2.

    There are several tools that are capable to do the job. One of them could be @Lehmden ‘s Media Buddy. @Lehmden , maybe you can provide more guidance.
     
  4. Lehmden
    • Team MediaPortal

    Lehmden Retired Team Member

    Joined:
    December 17, 2010
    Messages:
    11,723
    Likes Received:
    2,137
    Gender:
    Male
    Location:
    Lehmden
    Ratings:
    +3,587 / 28
    Home Country:
    Germany Germany
    Show System Specs
    Hi.
    Moving Pictures is able to use .nfo files. MP2 is able to use .nfo files. Bud sadly MyTVSeries is not.

    To get the data from Moving Pictures (incl your own modifications) is an easy task. There are tools available that can read the MovPic database and generates the needed .nfo files near to your videos. It's many, many years ago since I last used MP1 but I remember a tool named "MovPicNfo". If you search the forum you will find it surely. With this tool you get .nfo files and a copy of your artwork in an MP2 compatible manner. I've used this tool back in the days when I migrated from MP1 to MP2 and it was working nicely.

    But sadly there is no such tool for series. If I today still would use MP1 I most likely would have written such a tool... Should not be too hard to achieve. Most likely a batch file may be enough... But I don't need such a tool and I even don't have any TVSeries database to test with... Aside this my time is limited so I won't "waste" the time on things I never can use...

    Also .nfo files are XML files they are named .nfo. This is a traditional thing as they first were introduced by XBMC (today Kodi) as a pure database backup. MP2 only uses .nfo file for identifying and scrapping. The .imdbid.txt and the .WatchStatus.xml are not used by MP2.

    The watched flags you can transfer by a Trakt account or you may try my Tool MediaPortal-Buddy. My tool is outdated a bit regarding the watched status thing (the other things are still useful and working) as it's getting more and more complicated to modify the MP2 database. It's no problem to add watched flags for movies and episodes, but the seasons, series and moviesets don't get proper watched flags any more. As there is a plugin to backup and restore the watched flags included in MP2.2 and above there is no real need to develop this tool any further.

    For series I would suggest to start from scratch with something like tinyMediaManager or my tool Media-Buddy. Those tools are generating .nfo files for series, download artwork rename the files to a user defined naming scheme (if wanted) and you can modify the automatic scrapped data by hand later on. Media-Buddy also is able to transcode or remux your videos automatically, depending on your preferences. The wizards are allowing a "one click" preparation of many movies or series, means it decides if a video is too big and needs to be transcoded (lasts long depending on your PC hardware but saves disk space), or if it is in a "not that good" container and needs to be remuxed (fast work, similar time as to copy the file) and it also cleans the files by removing "unwanted" audio and subtitle tracks (if the user wants)... Then the finished videos are scrapped online and get .nfo and artwork attached. The videos are also renamed and the needed folder structure is created. And you can add metatags to the resulting mkv, exactly as you may do with music. All this with a single mouse click for an unlimited number of video files.

    Since a long time MP2 is able to read those video metatags. VLC (and many other media player) also reads a few of those tags. Kodi has followed this year (V18 and above) so the metatags for videos are widely usable. Metatags are partly supported in few container (e.g. .mp4) and with full features (as always) in .mkv container.

    Media-Buddy only is able to tag .mkv files as only with .mkv all needed tags are working.

    Similar is valid for remux. Remuxing to .mp4 leads way too often into an unusable file as .mp4 only supports a fraction of the streams that .mkv can contain. During my tests only about 20% of all remuxed .mp4 files were usable where .mkv has au quote of 100% working videos. That's why a "remux to .mp4" never was included in Media-Buddy...

    Transcoding is possible to .mkv and .mp4, adding fanart and metadata (.nfo) is possible to literally any video container, as you can add your own file extensions easily, if they are not supported directly...

    Another thing you may try...
    Media-Buddy is able to generate fanart and .nfo files even for videos that are not listed on any online database. The artwork is generated from video stills and is configurable widely. You may "copy&paste" the data from your MP1 databases to the .nfo generated by Media-Buddy so you may at least don't need to type everything again... And you also can replace the fanart, if you e.g. have found a cover for your documentary on Google (or so) without the need to rename the image to match the needed naming scheme...

    Once you've transferred your metadata to a proper .nfo file you can use them in every HTPC tool (MP2, Kodi, Emby, Plex,...) excerpt for MP1- MyTVSeries.

    With .nfo from Media-Buddy I always had a 100% match in MP2 and also in Kodi... No matter if it was a series episode or a movie or a home made video...

    You nevertheless need to invest some time and work, no matter which way you may go. If you need more info feel free to ask..
     
  5. raffe

    raffe Portal Pro

    Joined:
    March 28, 2008
    Messages:
    211
    Likes Received:
    35
    Ratings:
    +44 / 0
    Show System Specs
    First, @Lehmden , thanks for your ample answer :)

    Second, Moving Pictures. It seem that I remember it wrong. It was probably MovPicNFO that I used. Why it don't seem to work all the way with cover pictures is for an other discussion, I'm fine with knowing that there seems to be a solution for movies :)

    Third, MP-TVSeries. When you said "there is no such tool for series... Should not be too hard to achieve. Most likely a batch file may be enough.", I got interested. It was about 15 years since I last did real programing, but I still do some batch files in Linux (mostly straight forward backup scripts with checks and fail overs for backups over VPN tunnels and such). So maybe I could do my own batch file, maybe even share it here if I get i working. Is it OK if I ask you for some tips on how to proceed? How would you do the script? A fast guess from me would be something like:
    1. Make it work from the MediaPortal Program Files directory (like movpicnfo). Then we know where all files are.
    2. Find some command prompt tool that works with the MP-TVSeries DB in a general Windows env, say Win 7, 8 & 10.
      • Any suggestions for a DB tool?
    3. From MP-TVseries DB create xbmc .nfo files to TVSeries folder
      • What info is needed and what naming in XML, so MP2 will import the info?
    4. With info in MP-TVseries DB, copy Banner, Cover, FanArts, episode pic etc. TVSeries folder
      • What file naming should I use for the pictures, so MP2 will import them?
    5. What have I forgotten?
      • Do you see something I should add?
     
  6. Lehmden
    • Team MediaPortal

    Lehmden Retired Team Member

    Joined:
    December 17, 2010
    Messages:
    11,723
    Likes Received:
    2,137
    Gender:
    Male
    Location:
    Lehmden
    Ratings:
    +3,587 / 28
    Home Country:
    Germany Germany
    Show System Specs
    Hi.
    As I'm very familiar with Autoit I would use it of course. AutoIt has in-build SQLite support so I directly can read the TVSeries Database and then generate an XML file from the data in the DB. The path to the database can be given as an argument or a setting option. No need to run it from inside a specific folder then...
    If you don't know AutoIt, it's a basic alike scripting and programming language, very easy to learn and very powerful if you know what you're doing. Originally AutoIt was designed to remote control other Windows applications (Word, Photoshop,...) so it can simulate even mouse clicks in other windows. But as time goes by it has grown to a full blown procedural (opposite to object oriented) programming language incl usage of most Windows API and DLL. You even can compile the script/program to an 32 or 64 bit executable, if you like. The language and it's IDE is completely free. If you may have a look at Media-Buddy, it is written in Autoit and the source code is included in the installer package...
    An example how easy AutoIt is... I need a helper tool to restart the main program after settings change. It just waits for one second, runs the main program that was given as a command line option and then exit. I first wrote this tool in AutoIt and it needs only 3 lines of code.
    Code (Text):
    1. Sleep(1000)
    2. Run($CmdLine[1])
    3. Exit
    The first line waits for 1000 mSec
    The second line runs the program given as CL Option No. 1
    The third line cleanly exits the Tool.
    Aside this it don't need any extra runtimes or other installation.
    But this little helper tool very often was wrongly detected as a virus. so I decided to rewrote it in .NET (c#). Here exactly the same functionality (wait 1 second, run the main program and exit) needed 20 (to be exact 19 + 1 empty) lines of code.

    Code (C#):
    1. using System.Linq;
    2. using System.Diagnostics;
    3.  
    4. namespace Restart
    5. {
    6.     class Program
    7.     {
    8.         static void Main(string[] args)
    9.         {
    10.            System.Threading.Thread.Sleep(1000);
    11.            var exists = args.ElementAtOrDefault(0) != null;
    12.            if (exists)
    13.            {
    14.                 Process P = new Process();
    15.                 P.StartInfo.FileName = args[0];
    16.                 P.Start();
    17.            }
    18.         }
    19.     }
    20. }
    21.  
    Additionally this tool needs a .NET runtime to be installed on the system...

    But this tool throws not that often a "false positive" so I keep using it..

    You can use the "official" SQLite Tools:
    SQLite Download Page

    Here you best refer to the wiki and/or generate some .nfo with Media-Buddy so you can compare what's needed and how it should be named...

    You also can see how the artwork is named, if you prepare some test episodes in Media-Buddy. Or as above, read the Wiki...

    I don't remember exactly how the TVSeries DB is structured, so I can't give you much more hints. Simply too long ago.

    The artwork preparation is simple filecopy and rename... Should be straightforward as soon as you read the internal path and filename from TVSeries db.
     
    • Thank You! Thank You! x 1
  7. raffe

    raffe Portal Pro

    Joined:
    March 28, 2008
    Messages:
    211
    Likes Received:
    35
    Ratings:
    +44 / 0
    Show System Specs
    Last edited: March 19, 2019
    • Like Like x 3
  8. SINCowboy

    SINCowboy Portal Member

    Joined:
    September 3, 2015
    Messages:
    14
    Likes Received:
    3
    Gender:
    Male
    Ratings:
    +4 / 0
    Home Country:
    United States of America United States of America
    I was very excited to try your tool as I am attempting to migrate away from MP1. Unfortunately, it doesn't work for me. Taking your advice in the first post, I decided to take a look under the hood to see if I could make improvements or suggestions (note: my coding skills are decades old and rusty).

    Anyway, the first problem I have is with TV Series. The tool did not identify any episodes to migrate (although I have a fairly large collection). After taking a look at the code and structure of my TV Series database, I think the issue is with the code in line 573 "FROM local_episodes WHERE VolumeLabel = """ & $aTVSeriesSelectedPaths"

    I'm not sure if it is supposed to be this way, but in my database, the local_episodes VolumeLabel field contains the hard drive's volume label (e.g. MEDIASTORAGE)which is different than the ImportPathes Path name (e.g. E:\TV), so the tool does not find any matching episodes to export.

    I'm going to play around with it some more to see if I can find some simple fixes; however, from a quick look it appears that you use VolumeLabel in much of your code and I refer back to my previous statement of having very rusty coding skills.
     
  9. HTPCSourcer
    • Team MediaPortal
    • Administrator

    HTPCSourcer MP2 Product Manager

    Joined:
    May 16, 2008
    Messages:
    10,453
    Likes Received:
    1,103
    Gender:
    Male
    Ratings:
    +2,366 / 21
    Home Country:
    Germany Germany
    Show System Specs
    If your episodes are correctly named (unique series name, season/episode number as "S1E1" or "1x1") you don't need to migrate but can let the series importer do the job.
     
  10. SINCowboy

    SINCowboy Portal Member

    Joined:
    September 3, 2015
    Messages:
    14
    Likes Received:
    3
    Gender:
    Male
    Ratings:
    +4 / 0
    Home Country:
    United States of America United States of America
    problematic - htpc is currently on a capped internet connection so I don't want to reimport/download all my fanart, banners, posters, etc. Trying to find a way to migrate most of the collection locally (not to mention that I have some foreign series that aren't found by importers and don't want to lose/redo all the custom tagging that I've done over the years)
     
    Last edited: April 25, 2019
  11. raffe

    raffe Portal Pro

    Joined:
    March 28, 2008
    Messages:
    211
    Likes Received:
    35
    Ratings:
    +44 / 0
    Show System Specs
    OK, let's start checking for the error. My VolumeLabels are like this:
    Code (Text):
    1. \\192.168.222.247\Public\Filer\_Film_o_Musci\_TV-Series
    What exactly do yours have? Is it
    Code (Text):
    1. MEDIASTORAGE
    Do you see a table where it translates it from MEDIASTORAGE to E:\TV? If it ONLY say MEDIASTORAGE in one table, maybe we can also populate [Get folders] with "DISTINCT" values from table online_episodes and VolumeLabel (or maybe only do it)?

    What happens if you do
    1. Click button [Get folders]
    What "Path" do it show?
    2. Select a folder (check it)
    3. Click button [Folder selection info]
    What error do you get?
     
    Last edited: April 25, 2019
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!