NextPVR Forums
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 10 11 12 13 14 … 93 Next »
Extracting data from XML files

 
  • 0 Vote(s) - 0 Average
Extracting data from XML files
ACTCMS
Offline

Posting Freak

UK
Posts: 2,730
Threads: 101
Joined: Jun 2007
#1
2012-01-23, 11:09 PM
I'm getting a bit fed up hacking into XML files using a sledgehammer and crowbar...

From a node something like this...
Code:
<PictureLibrary extensions="^.+\.(bmp|jpg|png|tiff|tif)$">
    <Directory name="Family-1">\\Sbs2003\Media\Video Clips And Photos\Family\</Directory>
    <Directory name="Family-2">\\Sbs2003\Media\Video Clips And Photos\Scans\</Directory>
  </PictureLibrary>
I'd like to extract the extensions value into a string, the Directory names into a list and the Directory values into a list. There must be a nice elegant way of doing it.

All suggestions greatfully accepted...
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 102,394
Threads: 741
Joined: Nov 2003
#2
2012-01-23, 11:34 PM
Code:
// load list of root directories
            XmlNode librariesNode = SettingsHelper.GetInstance().GetSettingsNode("/Settings/LibraryDirectories/VideoLibrary");
            string extensions = librariesNode.Attributes["extensions"].InnerText;
            foreach (XmlNode directoryNode in librariesNode)
            {
                if (directoryNode.Name == "Directory")
                {
                    string name = directoryNode.Attributes["name"].InnerText;
                    string directory = directoryNode.InnerText;
                    Logger.Debug(name + " - " + directory);
                }
            }
ACTCMS
Offline

Posting Freak

UK
Posts: 2,730
Threads: 101
Joined: Jun 2007
#3
2012-01-23, 11:47 PM
Thanks sub - elegance personified...
bgowland
Offline

Posting Freak

Posts: 4,535
Threads: 376
Joined: Dec 2004
#4
2012-01-23, 11:56 PM
ACTCMS Wrote:Thanks sub - elegance personified...
Yeah but I reckon a lot of the code he doesn't show us is held together with sticky-tape and string. Big Grin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 102,394
Threads: 741
Joined: Nov 2003
#5
2012-01-24, 12:16 AM
I can neither confirm nor deny Big Grin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Loading Local Video Files Syler 25 3,600 2021-03-07, 09:20 PM
Last Post: Syler
  How to extract M3U8 and get matching XMLTV guide data from NPVR almightyj 0 2,129 2018-10-23, 07:24 AM
Last Post: almightyj
  Getting more than 24 hours of Guide Data scJohn 4 2,903 2018-05-16, 04:20 AM
Last Post: sub
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,277 2014-11-14, 02:05 AM
Last Post: Benoire
  Merge xmltv data with xslt Graham 4 2,747 2014-01-02, 12:45 PM
Last Post: Graham
  Refreshing TV Guide Data (after System plugin EPG update) imilne 13 4,547 2013-03-24, 08:03 PM
Last Post: imilne
  sabnzbd plugin to show processed files Wakalaka 1 1,482 2013-03-12, 06:48 AM
Last Post: psycik
  Get NextPVR data directory from outside a plugin McBainUK 3 1,600 2012-02-11, 05:42 PM
Last Post: mvallevand
  Building a list of files in media folders (npvr Music and Videos) bgowland 2 1,303 2012-02-05, 10:29 AM
Last Post: bgowland
  C# code to get data directory? McBainUK 2 2,321 2011-09-19, 07:57 PM
Last Post: McBainUK

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode