Author Topic: [SOLVED] Variable for FileName  (Read 5035 times)

0 Members and 1 Guest are viewing this topic.

Offline kmickeletto

  • Member
  • *
  • Posts: 4
    • View Profile
[SOLVED] Variable for FileName
« on: August 07, 2010, 04:26:59 am »
Hi, I use PVD to manage my video collection and I export to XML for my Roku box (Roksbox application).  I have had a continual issue with the <path> section.  The default script creates the path with the drive letter intact.  When passing the XML file to a my Roku which is technically a HTTP client, it pukes using the path with the drive letter.

I noticed I can modify the results of the XML file that is built by playing with the XML (Movies).ptm file.  My problem is, I can't seem to find a variable that just has the filename instead of the filename and path.  Can anyone help?

Thanks so much!
Ken
« Last Edit: September 22, 2010, 12:43:24 am by rick.ca »

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Variable for FileName
« Reply #1 on: August 07, 2010, 05:01:08 am »
Welcome, Ken.

<path>{#StringReplace '{%value=path}' 'D:' '')}</path> works—assuming all your files are on one drive ('D:'). If not, I don't know...maybe the function can be nested.

Offline kmickeletto

  • Member
  • *
  • Posts: 4
    • View Profile
Re: Variable for FileName
« Reply #2 on: August 07, 2010, 04:19:41 pm »
Perfect!  That was exactly what I was looking for.  I did find stuff about stringreplace on the forum, but I just wasn't sure how to implement it.   I ended up making a slight change to your example and it is working perfectly.  Thanks!

Code: [Select]
<path>{#StringReplace '{%value=path}' 'F:\Roku\movies\' 'movies/')}</path>

Offline svenne

  • Power User
  • ****
  • Posts: 145
    • View Profile
Re: Variable for FileName
« Reply #3 on: August 08, 2010, 11:43:16 am »
Maybe the second function here might be more reliable... easier to deal with different drives and paths:
ExtractFileName
see here:
http://www.videodb.info/help/hlp_export.html#functions

I think the following should work, but I didn't test it. If you're satisfied with your solution, then you just might want to keep it your way... nevertheless:
Code: [Select]
<path>movies/{#ExtractFileName '{%value=path}'}</path>

 

anything