MinimServer Forum

Full Version: Playlist / Direcotry slashes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

i have minim running on a QNAP, but the playlists are being created from a windows machine and so the directory names are separted by backward slashes and not forward slashes. i use winamp to create the playlists (as it has a great media libraray functionality), and there is no option to define the directory separator.
would it be possible to make minim less restrictive about the directory separator and let it accept backward slashes "\" as separator?

greets
KoS
(17-05-2013 15:18)KoS Wrote: [ -> ]Hi

i have minim running on a QNAP, but the playlists are being created from a windows machine and so the directory names are separted by backward slashes and not forward slashes. i use winamp to create the playlists (as it has a great media libraray functionality), and there is no option to define the directory separator.
would it be possible to make minim less restrictive about the directory separator and let it accept backward slashes "\" as separator?

greets
KoS

Translating '\' to '/' in a Linux playlist doesn't seem right to me. A Linux file path can contain a real '\' and I don't think it would be correct for MinimServer to override this.

oddgravity Playlist Creator is a free tool that provides the option to create relative playlists with the correct '/' path separator. See this page for more information. I have tried this and it works well with MinimServer.
(17-05-2013 16:40)simoncn Wrote: [ -> ]Translating '\' to '/' in a Linux playlist doesn't seem right to me. A Linux file path can contain a real '\' and I don't think it would be correct for MinimServer to override this.
i see the point, but i suppose there are many users that have a NAS with minimserver on it and are creating their playlists from windows-based tools (that often don't have an option to the change the \ to /). and i think i never saw a artist/title etc that has a "\" in its name? ;-)

Quote:oddgravity Playlist Creator is a free tool that provides the option to create relative playlists with the correct '/' path separator. See this page for more information. I have tried this and it works well with MinimServer.
yes i know, i tried it to with that tool and it works. but the usability isn't very great.... if i have 30'000 songs and i have to "find" them by browsing through metadata it is not very funny..... as everything is properly tagged and so a music library / media manager tool that uses the metadata is much more convenient to create playlists. i would be happy to have a web-based tool that i can put on the NAS and that is only used to create playlists in a simple manner.... and has not 1000 other features for e.g. editing metadata etc....

a upnp-related question: isn't there any possibility in the upnp standard to write data back to the media server? e.g. the control point "saving" a playlist on the upnp server? as far i haven't seen any product that implements something like that, so i suppose there is no standard for it? .... at least linn started with their songbox to have some possibility to save playlists that have been created with kinsky on their upnp server. so it is possible to create playlists "on-the-go", and use them on all control points....
(17-05-2013 16:50)KoS Wrote: [ -> ]yes i know, i tried it to with that tool and it works. but the usability isn't very great.... if i have 30'000 songs and i have to "find" them by browsing through metadata it is not very funny..... as everything is properly tagged and so a music library / media manager tool that uses the metadata is much more convenient to create playlists. i would be happy to have a web-based tool that i can put on the NAS and that is only used to create playlists in a simple manner.... and has not 1000 other features for e.g. editing metadata etc....

You could create your playlists using Winamp and then use a Windows file editing utility to convert the '\' characters to '/'. On Windows, I have used sfk (Swiss File Knife) for tasks like this. For details, see this page. You can make the '\' to '/' change with the command:

sfk167 replace myplaylist.m3u _\_/_ -yes

I'm sure there are many other similar utilities.

Quote:a upnp-related question: isn't there any possibility in the upnp standard to write data back to the media server? e.g. the control point "saving" a playlist on the upnp server? as far i haven't seen any product that implements something like that, so i suppose there is no standard for it? .... at least linn started with their songbox to have some possibility to save playlists that have been created with kinsky on their upnp server. so it is possible to create playlists "on-the-go", and use them on all control points....

The UPnP ContentDirectory service provides an optional facility for uploading files to the server (ImportResource), but most UPnP media server implementations and control points don't support this.

The Linn approach makes sense if your control point and server both support it. It's possible that I might investigate adding support for this in a future release of MinimServer, but for now you'll need to use the existing support for server-side .m3u playlists.
Had a play with Swiss File Knife and got it working but it made me think I should really tackle the problem at source.
I use MediaMonkey to create Playlists and there was an existing script to export all Playlists.
This one uses the windows assigned drive letter and the windows \ instead of the unix /.
So I have now created a new script to export all playlists which uses the unix / and does not use the windows drive letter. As long as you save them in the root directory specified for MiminServer they work fine.

script: the filename is ExportM3Uq.vbs in directory c:\program files\mediamonkey\scripts

' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' This file can be replaced in one of the future versions,
' so please if you want to modify it, make a copy, do your
' modifications in that copy and change Scripts.ini file
' appropriately.
' If you do not do this, you will lose all your changes in
' this script when you install a new version of MediaMonkey
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Option Explicit ' report undefined variables, ...

' SDB variable is connected to MediaMonkey application object

' Recursively process all playlists
Sub ReadPlaylists( playlists, plst, prefix)
Dim items
Set items = plst.ChildPlaylists

If prefix<>"" Then
prefix = prefix & " - "
End If

Dim i, newplst, title
For i=0 To items.Count-1
Set newplst = items.Item(i)
title = prefix & newplst.Title
If Not playlists.exists(title) Then
playlists.Add title, newplst
End If
ReadPlaylists playlists, newplst, title
Next
End Sub

Sub ExportM3Uq
' Open inifile and get last used directory
Dim iniF
Set iniF = SDB.IniFile

' Let user select the output path
Dim path
path = iniF.StringValue( "Scripts", "LastExportM3UqDir")

path = SDB.SelectFolder( path, SDB.Localize( "Select where to export all M3U files."))

If path="" Then
Exit Sub
End If

If Right( path, 1)<>"\" Then
path = path & "\"
End If

' Write selected directory to the ini file
iniF.StringValue( "Scripts", "LastExportM3UqDir") = path
Set iniF = Nothing

' Connect to the FileSystemObject
Dim fso
Set fso = SDB.Tools.FileSystem

Dim playlists
Set playlists = CreateObject("Scripting.Dictionary")

' Use progress to notify user about the current action
Dim Progress, ExpText
Set Progress = SDB.Progress
ExpText = SDB.Localize("Exporting...")
Progress.Text = ExpText

' Prepare a list of all playlists
ReadPlaylists playlists, SDB.PlaylistByTitle( ""), ""

' Go through the list and export each playlist
Dim i, iTrck, plst, fout, plsts, titles, title, tracks, trck, pwtlen, pwrlen, pwloc, pwtrack
plsts = playlists.Items
titles = playlists.Keys
Progress.MaxValue = playlists.count
For i=0 To playlists.Count-1
Set plst = plsts(i)
Set tracks = plst.Tracks
title = Titles(i)
Progress.Text = ExpText & " (" & title & ")"
If tracks.Count>0 Then
Set fout = fso.CreateTextFile( path & fso.CorrectFilename(title) & ".m3u", True)
fout.WriteLine "#EXTM3U"
For iTrck=0 To tracks.Count-1
Set trck = tracks.Item(iTrck)
pwtlen = len(trck.Path)
pwrlen = pwtlen-8
pwloc = right(trck.Path,pwrlen)
pwtrack = replace(pwloc,"\","/")
fout.WriteLine pwtrack
Next
fout.Close
End If
Progress.Value = i+1
Next
End Sub

You also need to add the script to the scipts.ini file, my script.ini file contains

[Statistics]
FileName=Stats.vbs
ProcName=ShowStats
Order=1
DisplayName=&Statistics
Description=Library Statistics Report
Language=VBScript
ScriptType=1

[ExportHTML]
FileName=Export.vbs
ProcName=ExportHTML
Order=2
DisplayName=File List (&HTML)
Description=Exports list of selected files to a .htm file
Language=VBScript
ScriptType=1

[ExportXML]
FileName=Export.vbs
ProcName=ExportXML
Order=3
DisplayName=File List (&XML)
Description=Exports list of selected files to an .xml file
Language=VBScript
ScriptType=1

[ExportCSV]
FileName=Export.vbs
ProcName=ExportCSV
Order=4
DisplayName=File List (CS&V)
Description=Exports list of selected files to a .csv file
Language=VBScript
ScriptType=1

[ExportXLS]
FileName=Export.vbs
ProcName=ExportXLS
Order=5
DisplayName=File List (&Excel)
Description=Exports list of selected files to a .xls file
Language=VBScript
ScriptType=1

[AutoIncTrackN]
FileName=AutoIncTrackN.vbs
ProcName=AutoIncTrackNumbers
Order=10
DisplayName=Auto-&increment Track #s...
Description=Sequentially numbers files
Language=VBScript
ScriptType=0

[SwapArtistTitle]
FileName=SwapArtistTitle.vbs
ProcName=SwapArtistTitle
Order=20
DisplayName=&Swap Artist and Title
Description=Swaps Artist and Title fields
Language=VBScript
ScriptType=0

[Case]
FileName=Case.vbs
ProcName=TitleCase
Order=30
DisplayName=Case Checker...
Description=Checks for correct capitalization
Language=VBScript
ScriptType=0

[ExportM3Us]
FileName=ExportM3Us.vbs
ProcName=ExportM3Us
Order=40
DisplayName=Export all Playlists...
Description=Exports all Playlists to .m3u
Language=VBScript
ScriptType=0

[ExportM3Uq]
FileName=ExportM3Uq.vbs
ProcName=ExportM3Uq
Order=41
DisplayName=Exp Playlists for MinimServer
Description=Exports all Playlists to .m3u for MinimServer
Language=VBScript
ScriptType=0


[ExportOPML]
FileName=ExportOPML.vbs
ProcName=ExportOPML
Order=50
DisplayName=Export subscribed Podcasts...
Description=Exports subscribed Podcasts to .opml file
Language=VBScript
ScriptType=0


Regards, Peter
oops, should have said, my QNAP drive where MinimServer runs, is mapped the windows drive X and the music files are in a directory call flac. So in windows notations the music files are in X:\FLAC\
In the script above there is a line which reads pwrlen = pwtlen-8
The -8 is to get rid of the X:\FLAC\ in the track filename. So you will need to alter the 8 to the length of the drive & directory name you use.
PM me if you have any questions
(18-05-2013 23:06)Peter@57m Wrote: [ -> ]oops, should have said, my QNAP drive where MinimServer runs, is mapped the windows drive X and the music files are in a directory call flac. So in windows notations the music files are in X:\FLAC\
In the script above there is a line which reads pwrlen = pwtlen-8
The -8 is to get rid of the X:\FLAC\ in the track filename. So you will need to alter the 8 to the length of the drive & directory name you use.
PM me if you have any questions

Hi Peter,

Thanks very much for creating this script and sharing it!

Simon
Reference URL's