Editing
File Path and Identifier Functions
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Function Type Page}} The functions in this section provide specific file-related information such as a file's name, path, volume, and other Media Center internal information. === <span id="DBLocation">DBLocation(…)</span> === : Identifies a file's databases. {{function description box | name=DBLocation | arguments= | description= [[#DBLocation|DBLocation()]] behaves exactly as [[#FileDBLocation|FileDBLocation(0)]], and takes no parameters, returning only a semicolon-separated list of formatted database names. | examples= See [[#FileDBLocation|FileDBLocation()]] }} === <span id="Enviro">Enviro(…)</span> === : Returns a specified host system variable {{function description box | name=Enviro | arguments=System_Variable | description= [[#Enviro|Enviro()]] will lookup a given system variable and return its full path or contents. Note that the function only requires the variable name, bookended % signs are not necessary. | examples= '''{{monospace|Enviro(SystemRoot)}}''' : Returns the system folder, typically C:\Windows '''{{monospace|Enviro(SystemDrive)}}''' : Returns the drive the system is installed on, typically, C: }} === <span id="FileDBLocation">FileDBLocation(…)</span> === : Identifies a file's databases. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FileDBLocation" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filedblocation(</b><i>format</i><b>)</b></span> The [[#FileDBLocation|FileDBLocation()]] function returns identifiers in the specified <i>format</i> that indicate to which internal database(s) a file belongs. Media Center maintains several internal databases to track a file's disposition. This function is primarily for technical use only, and will have little utility for most users. Available <i>format</i> values: <div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9"> <tr><td style="text-align:left; padding-right:20pt"><b>0</b></td><td>Semicolon-separated list of formatted database names</td></tr> <tr><td style="text-align:left; padding-right:20pt"><b>1</b></td><td>Numeric value of OR'd database bit flags</td></tr> </table></div> The table below provides common values output from [[#FileDBLocation|FileDBLocation()]]: <div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9" border="1"> <tr><td style="text-align:left; padding-right:20pt">Database name</td><td>Bit position</td></tr> <tr><td style="text-align:left; padding-right:20pt">Main</td><td>0</td></tr> <tr><td style="text-align:left; padding-right:20pt">Playing Now</td><td>1</td></tr> <tr><td style="text-align:left; padding-right:20pt">CD</td><td>2</td></tr> <tr><td style="text-align:left; padding-right:20pt">Explorer</td><td>3</td></tr> <tr><td style="text-align:left; padding-right:20pt">Other (16)</td><td>5</td></tr> <tr><td style="text-align:left; padding-right:20pt">Other (6)</td><td>6</td></tr> <tr><td style="text-align:left; padding-right:20pt">Grouping</td><td>7</td></tr> <tr><td style="text-align:left; padding-right:20pt">Removed</td><td>8</td></tr> <tr><td style="text-align:left; padding-right:20pt">Podcast</td><td>10</td></tr> <tr><td style="text-align:left; padding-right:20pt">Other (4096)</td><td>12</td></tr> <tr><td style="text-align:left; padding-right:20pt">Stacks</td><td>14</td></tr> <tr><td style="text-align:left; padding-right:20pt">Category Images</td><td>18</td></tr> <tr><td style="text-align:left; padding-right:20pt">Bad</td><td>19</td></tr> </table></div> Argument <i>format</i> is optional (defaults to 0). |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filedblocation()</nowiki></b></span> <p style="margin-left:20pt;">For a file in the <span style="font-family: monospace,monospace; font-size:1em;">Main</span> and <span style="font-family: monospace,monospace; font-size:1em;">Other (4096)</span> databases, the result would be <span style="font-family: monospace,monospace; font-size:1em;">Main; Other (4096)</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filedblocation(1)</nowiki></b></span> <p style="margin-left:20pt;">The result from the same file would be <span style="font-family: monospace,monospace; font-size:1em;">4096</span> (bit 0 and bit 12 set).</p> Additional Examples :[http://yabb.jriver.com/interact/index.php?topic=77896.msg539271#msg539271 Sample expression that uses FileDBLocation() to show a file's databases.] |} <div style="text-align:right;">([[#top|Back to top)]]</div> === <span id="FileFolder">FileFolder(…)</span> === : Returns the name of a file's parent. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FileFolder" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filefolder(</b><i>filepath</i><b>, </b><i>level</i><b>)</b></span> The [[#FileFolder|FileFolder()]] function returns parent sub-folder name for <i>filepath</i>. The <i>level</i> argument specifies which parent sub-folder name to return, working the <i>filepath</i> from right-to-left (i.e. bottom of the folder tree upwards to the top). A value of 0 specifies a file's immediate parent, 1 its grandparent, etc., up to the root of the <i>filepath</i>. A value of <span style="font-family: monospace,monospace; font-size:1em;">Unassigned</span> will be returned when the specified <i>level</i> exceeds the root of the <i>filepath</i>. Argument <i>filepath</i> is optional (defaults to [filename]). Argument <i>level</i> is optional (defaults to 0). |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filefolder()</nowiki></b></span> <p style="margin-left:20pt;">Returns the name of the file's parent folder.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filefolder([filename,0], 0)</nowiki></b></span> <p style="margin-left:20pt;">Same as the previous example.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filefolder(c:\some\folder\for\a\file.ape, 2)</nowiki></b></span> <p style="margin-left:20pt;">Returns the great grandparent sub-folder named <span style="font-family: monospace,monospace; font-size:1em;">folder</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filefolder(c:\some\other\folder\a\, 2)</nowiki></b></span> <p style="margin-left:20pt;">Returns the folder named <span style="font-family: monospace,monospace; font-size:1em;">other</span>. Notice the file name is not required in the <i>filepath</i>. [[#FileFolder|FileFolder()]] works by looking from the end of the <i>filepath</i> until it finds a backslash <span style="font-family: monospace,monospace; font-size:1em;">\</span>.</p> |} <div style="text-align:right;">([[#top|Back to top)]]</div> === <span id="FileKey">FileKey(…)</span> === : Returns a file's unique internal identifier. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FileKey" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filekey()</b></span> The [[#FileKey|FileKey()]] function returns the unique identifier associated with a file. Media Center assigns a unique identifier to each file in the Library. It is useful in expressions when referring to individual files is necessary. Services such as MCWS use this value to reference a file. |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filekey()</nowiki></b></span> <p style="margin-left:20pt;">Returns a integer value, such as <span style="font-family: monospace,monospace; font-size:1em;">22029495</span>, unique for each file in the Library.</p> |} <div style="text-align:right;">([[#top|Back to top)]]</div> === <span id="FileLookup">FileLookup(…)</span> === : Looks up a file from its filename {{function description box | name=FileLookup | arguments=Filename | description= [[#FileLookup|FileLookup()]] will lookup a file from a given filename, returning its assigned [[#FileKey]] | examples= '''{{monospace|FileLookup([filename])}}''' : Returns the filekey of each file run against it. '''{{monospace|FileLookup(C:\Track /(Test/))}}''' : Returns the filekey of the specified file. Note that when entering the filename directly, any special characters ''must'' be escaped otherwise, the expression will break. }} === <span id="FileName">FileName(…)</span> === : Returns a file's name component. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FileName" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filename(</b><i>filepath</i><b>, </b><i>include suffix</i><b>)</b></span> The [[#FileName|FileName()]] function returns the file name part of <i>filepath</i>. Inclusion of the file's suffix depends on the <i>include suffix</i> argument. <div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9"> <tr><td style="text-align:left; padding-right:20pt"><b>0</b></td><td>Suppress file suffix</td></tr> <tr><td style="text-align:left; padding-right:20pt"><b>1</b></td><td>Include file suffix</td></tr> </table></div> Argument <i>filepath</i> is optional (defaults to [filename]). Argument <i>include suffix</i> is optional (defaults to 1). |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filename(C:\Music\File.mp3)</nowiki></b></span> <p style="margin-left:20pt;">The output is <span style="font-family: monospace,monospace; font-size:1em;">File.mp3</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filename(C:\Music\File 2.wav, 0)</nowiki></b></span> <p style="margin-left:20pt;">The output does not include the file suffix, and is <span style="font-family: monospace,monospace; font-size:1em;">File 2</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filename()</nowiki></b></span> <p style="margin-left:20pt;">Returns the value contained in the field [filename (name)].</p> |} <div style="text-align:right;">([[#top|Back to top)]]</div> === <span id="FilePath">FilePath(…)</span> === : Returns a file's path component. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FilePath" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filepath(</b><i>filepath</i><b>)</b></span> The [[#FilePath|FilePath()]] function will return the path portion of the specified file path. The <i>filepath</i> should be a rooted path. For Windows, this includes the drive letter or leading <span style="font-family: monospace,monospace; font-size:1em;">\\</span> for UNC paths. For *nix-based systems, this includes the root <span style="font-family: monospace,monospace; font-size:1em;">/</span>. The field [filename (path)] is equivalent to [[#FilePath|FilePath()]], and is generally preferred. Argument <i>filepath</i> is optional (defaults to [filename]). |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filepath(C:\Music\File.mp3)</nowiki></b></span> <p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">C:\Music</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filepath()</nowiki></b></span> <p style="margin-left:20pt;">Returns the value contained in the field [filename (path)].</p> |} <div style="text-align:right;">([[#top|Back to top)]]</div> === <span id="FileVolume">FileVolume(…)</span> === : Returns a file's volume name component. {| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |- id="FileVolume" valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>filevolume(</b><i>filepath</i><b>)</b></span> The [[#FileVolume|FileVolume()]] function returns the volume name component of the specified file path. The path should be a rooted path (see the same comment above for [[#FilePath|FilePath()]]. For *nix-based systems, the output is empty. The field [volume name] is equivalent to [[#FileVolume|FileVolume()]], and is generally preferred. Argument <i>filepath</i> is optional (defaults to [filename]). |- valign="top" ! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filevolume(C:\Music\File.mp3)</nowiki></b></span> <p style="margin-left:20pt;">Outputs <span style="font-family: monospace,monospace; font-size:1em;">C:</span>.</p> <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>filevolume()</nowiki></b></span> <p style="margin-left:20pt;">Returns the value contained in the field [volume name].</p> |} <div style="text-align:right;">([[#top|Back to top)]]</div>
Summary:
Please note that all contributions to wiki.jriver.com may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki.jriver.com:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Function Description Box
(
edit
)
Template:Function Type Page
(
edit
)
Template:Function description box
(
edit
)
Template:Hatnote
(
edit
)
Template:Monospace
(
edit
)
Template:See also
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Interact Forum
Main Page
User Manual
Community portal
Recent changes
Tools
What links here
Related changes
Special pages
Page information