Version truncating the filename in the filebrowser.

WP-Filebase Pro Forums Templates Version truncating the filename in the filebrowser.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #609
    fafdk
    Participant

    Version truncating the filename in the filebrowser.

    Hi Fabian

    I have a little problem after the scan, and it is with the filenames view in the filebrowser. Where can I remove the version function, which cuts the filename in half, if the filename has ex. 01.01.01-01.02.03.mp3 – it shows as 01.01.01 in the filelist and 01.02.03 as the version.

    So what I’m looking for, is a way to disable “version” during the scan (rsync) process. Of course, I could go thought each file afterwards, and cut the version name and put it back to the file-name, but that would take me some time.

    Thank you for the improvements.

    • This topic was modified 8 years, 9 months ago by fafdk.
    • This topic was modified 8 years, 9 months ago by fafdk.
    • This topic was modified 8 years, 9 months ago by fafdk.
    • This topic was modified 8 years, 9 months ago by fafdk.
    • This topic was modified 8 years, 9 months ago by fafdk.
    #617
    Fabian
    Participant

    In classes/Admin.php, comment out theses lines:

    	$result = self::ParseFileNameVersion($file_name, $file->file_version);	
    	if(empty($file->file_version)) $file->file_version = $result['version'];
    	if(empty($file->file_display_name)) $file->file_display_name = $result['title'];
    
    #619
    fafdk
    Participant

    Thx, but after I commented it out and ran a scan, it does not generate a filename anymore, just the path.

    #620
    fafdk
    Participant

    I put the lines in again, and changed this line:

    if(preg_match('/[-_\.]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {`

    to this:

    if(preg_match('/[\]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {

    From here:

    static function ParseFileNameVersion($file_name, $file_version) {
    $fnwv = substr($file_name, 0, strrpos($file_name, '.'));// remove extension
    if(empty($file_version)) {
    $matches = array();	
    if(preg_match('/[-_\.]v?([0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2}){0,2})(-[a-zA-Z_]+)?$/', $fnwv, $matches)) {
    $file_version = $matches[1];
    if((strlen($fnwv)-strlen($matches[0])) > 1)
    $fnwv = substr($fnwv, 0, -strlen($matches[0]));
    }	
    } elseif(substr($fnwv, -strlen($file_version)) == $file_version) {	
    $fnwv = trim(substr($fnwv, 0, -strlen($file_version)), '-');
    }
    $title = WPFB_Core::GetOpt('no_name_formatting') ? $fnwv : wpfb_call('Output', 'Filename2Title', array($fnwv, false), true);	
    return array('title' => empty($title) ? $file_name : $title, 'version' => $file_version);
    }

    Maybe it’s a rough hack, but it seems to work.

    I’ll wait for a proper update.

    /FAF

    #621
    fafdk
    Participant

    Maybe an option to turn off the “automatic versionering from filename” would be a nice feature to have? – and/or to choose which symbols would be used in the filename.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.