Community
    • Login

    Trying to auto copy select text from a .nfo file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 11 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dawn Brockman 0D
      Dawn Brockman 0
      last edited by

      Here is what I have and what I’m trying to do:
      I’m running this on a windows 11 laptop
      I’m trying to clean up my “Movies” and “TV Show” external hard drives.

      I’m trying to add tags to my .mkv and .mp4 files

      So here is what I’m trying to do:
      I want to keep some select text but not all text.

      I will be making copies of the nfo files and making the copies txt files and then editing the txt files.

      Here is what my nfo file currently looks like for my movie called “6 Underground (2019)”
      Here is a bunch of code:
      <?xml version=“1.0” encoding=“UTF-8” standalone=“yes”?>
      <movie>
      <fileinfo>
      <streamdetails>
      <video>
      <width>720</width>
      <height>300</height>
      <aspect>2.39</aspect>
      <codec>h264</codec>
      <format>avc1</format>
      <durationinseconds>7732</durationinseconds>
      <bitrate>1 100 kb/s</bitrate>
      <container>.mp4</container>
      <scantype>Progressive</scantype>
      <framerate>23.976</framerate>
      <NumVideoBits>8</NumVideoBits>
      </video>
      <audio>
      <language>eng</language>
      <DefaultTrack>Yes</DefaultTrack>
      <codec>aac</codec>
      <channels>2</channels>
      <bitrate>256 kb/s</bitrate>
      </audio>
      </streamdetails>
      </fileinfo>
      <title>6 Underground</title>
      <originaltitle>6 Underground</originaltitle>
      <sorttitle>6 Underground</sorttitle>
      <outline>Six individuals from all around the globe, each the very best at what they do, have been chosen not only for their skill, but for a unique desire to delete their pasts to change the future.</outline>
      <plot>Six individuals from all around the globe, each the very best at what they do, have been chosen not only for their skill, but for a unique desire to delete their pasts to change the future.</plot>
      <tagline>They say no one can save the world. Meet no one.</tagline>
      <year>2019</year>
      <premiered>2019-12-10</premiered>
      <ratings>
      <rating name=“imdb” max=“10” default=“true”>
      <value>6.100000</value>
      <votes>196747</votes>
      </rating>
      <rating name=“themoviedb” max=“10”>
      <value>6.300000</value>
      <votes>4566</votes>
      </rating>
      </ratings>
      <userrating>0</userrating>
      <top250>0</top250>
      <country>United States of America</country>

      From the code above all I need is the <year>2019</year> but I want to 2019 not the <year></year>. The next thing I would need is:

      <genre>Action</genre>
      <genre>Thriller</genre>
      and then the:
      <stars>Ryan Reynolds / Mélanie Laurent / Manuel Garcia-Rulfo</stars>

      And no I don’t need every single “Actor” since some actors are not even credited. I just want the main actors which are already listed in the “Stars” area.

      So I want the stuff in between the “year”, “Genre”, “Stars”. So this way I can add the main tags myself. It is a lot of text to work through so I was wondering if this is at all possible with “Notepad++” and if so could someone please let me know how to do this. Thank you in advance.

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC
        Coises @Dawn Brockman 0
        last edited by Coises

        @Dawn-Brockman-0:

        I’m don’t know if Notepad++ will be a great deal of help here, though I’m not sure I follow your proposed workflow.

        I take it you have a bunch of media with Kodi-style nfo files beside the media files. What program produced the nfo files? (If it happens to be Tiny Media Manager, I know that program can export a CSV or similar file from selected fields. That file could then be manipulated in Notepad++.)

        There is an XML Tools plugin for Notepad++. I don’t use it, so I’m not sure if it has the capacity to work with an entire directory tree of xml files.

        Unless a facility like the one I mentioned for Tiny Media Manager is available, most likely you would be better using a scripting language, like Python, to discover the files, read them as XML, and write a file containing the information you need to process. You could then load that into Notepad++ for editing.

        (I’m not saying it’s impossible with just Notepad++, but it will be slow, annoying and error-prone.)

        I’m trying to add tags to my .mkv and .mp4 files

        That will require some sort of scripting. If it’s something like a batch file you’re planning to write, with a line for each file calling mp4box for mp4 files and something else for mkv files, Notepad++ could be of help turning a file with one line for each nfo file into a batch file to update the corresponding media files.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors