Menu

Make directories

Help
CV Soft
2003-08-27
2004-02-18
  • CV Soft

    CV Soft - 2003-08-27

    I'd like to make a directory for each artist and album.
    I do
    perl ./aranger.pl -f "/%a/%t/%f" -P "./mp3"
    but with each file I get the error message that the file can't be moved to that directory, because the directory doesn't exist.

    Also --gronk doesn't seem to make the directories if they don't exist.

    For example,
    /publiek/mp3/Almost The Edge of the Earth.mp3 and /publiek/mp3/70 Seconds From Mars/Almost The Edge of the Earth.mp3: COULDN'T MOVE: No such file or directory

    Am I doing something wrong?
    Thanks for any help.

     
    • Greg Hazel

      Greg Hazel - 2003-11-06

      First of, my apologies! I hadn't been monitoring this forum, only "Bugs".

      I did a quick test with 0.0.15 and didn't run in to the problem you specified. What version are you using?

      Regardless of version, specify -V 7 on the command line and it will print a message when a directory does not exist (and it is about to create it). Also, if you use the logging feature (-L foo.log) you should see a "mkdir" line for each folder it need to create.

      Please let me know if any of these options help you discover more about the problem :)

       
    • David Fletcher

      David Fletcher - 2004-02-17

      I'm having a similar problem on Gentoo:
      <pre>
      david@home aranger $ perl aranger.pl -L foo.txt -V 7 -f "%A/%t/%f" -r -P ~/media/test/
      Using Cwd 'abs_path'...
      Using MP3::Info...
      Using MP3::Tag...
      Using Ogg::Vorbis::Header::PurePerl...
      Using Approx...
      Using Unique...
      Using Clone...
      Using Unidecode...

      ----------------------------------------------------------
      aranger v 0.0.15 by Leif Jonsson (lejon@ju-jutsu.com)
                       and Greg Hazel (gah@thalassocracy.org)
      ----------------------------------------------------------

      No user preferences file (/home/david/.aranger.rc)

      Writing logfile: foo.txt
      Please wait, working...
      Finding files...

      Finished initialisation pass...
      Finished scoring pass...

      Starting voting pass...

      Starting post-processing pass...

      Wrapping up post-processing...
      --------------------------------------------------------------
      Orig Filename: 16_-_Beach_Boys_-_Trombone_Dixie.mp3
      Path         : /mnt/hd3/david/media/test
      New Filename : 16_-_Beach_Boys_-_Trombone_Dixie.mp3
      New Path     : /mnt/hd3/david/media/test/Beach_Boys/Pet_Sounds
      Groups       : [_Beach_Boys_] [_Trombone_Dixie] [16_]
      TAG Version  : ID3v1.1 / ID3v2.3.0

      Title        : Trombone_Dixie -> 17
      Artist       : Beach_Boys -> 17
      Album        : Pet_Sounds -> 17
      Track        : 16 -> 19
      Comments     : 16
      --------------------------------------------------------------

      Renaming files and modifying tags...

      Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/vendor_perl/5.8.0/File/Spec/Unix.pm line 311.
      Use of uninitialized value in split at /usr/lib/perl5/vendor_perl/5.8.0/File/Spec/Unix.pm line 312.
      /mnt/hd3/david/media/test/16_-_Beach_Boys_-_Trombone_Dixie.mp3 and /mnt/hd3/david/media/test/Beach_Boys/Pet_Sounds/16_-_Beach_Boys_-_Trombone_Dixie.mp3: COULDN'T MOVE: No such file or directory
      Path did not exist: /mnt/hd3/david/media/test/Beach_Boys/Pet_Sounds
      Processed: 1 total files.
      Exit.
      </pre>

       
      • Greg Hazel

        Greg Hazel - 2004-02-18

        Thanks for the debugging info! I've fixed the bug, which was due to abs_path() returning a blank string if the path was already absolute. The only thing absolute about it, is that it makes no sense.

        If you want to patch your version, change the smart_rel2abs() function to read:

        sub smart_rel2abs{
          my $dir=shift;

          if (not File::Spec->file_name_is_absolute($dir))
          {
            if ($^O eq 'NT' or $^O eq 'MSWin32') {
              $dir=RelativeToAbsolute($dir);
            } else {
              $dir=abs_path($dir);
            }
          }

          return $dir;
        }

         

Log in to post a comment.