Hifidelio-User.de

Das (inoffizielle!) Forum für Hifidelio-User
Aktuelle Zeit: 20.10.2017 17:59

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]




Ein neues Thema erstellen Auf das Thema antworten  [ 20 Beiträge ]  Gehe zu Seite 1, 2  Nächste
Autor Nachricht
 Betreff des Beitrags: Music folder
BeitragVerfasst: 05.04.2007 23:48 
Offline
Benutzeravatar

Registriert: 22.02.2007 01:03
Beiträge: 441
A month ago I bought a HF.
It came with firmware 2.3.8
Now I'm running 2.3.14
As 14 minus 8 is approximately 6, I had to change smb.conf 6 times.
To backup the HF to my NAS I simply need read access to the music folder.

Would you please, please, please consider making it readable over the network by default.

btw: is a backup of the music folder sufficient or should one backup the database as well?

_________________
the Rough Guide to the Hifidelio has become part of The Well Tempered Computer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 01:44 
Offline
Moderator
Benutzeravatar

Registriert: 27.02.2005 13:05
Beiträge: 1194
Where did you get the 2.3.14? My HF runs on 2.3.13! :wink:

_________________
hifi war gestern, hifidelio ist heute!


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 01:51 
Offline

Registriert: 27.11.2006 09:32
Beiträge: 166
If you stuck to the standard software (no betas), you only had to do it once. IIRC, it went straight from 2.3.8 to 2.3.14. All the inbetweeners were betas.


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 01:54 
Offline
Moderator
Benutzeravatar

Registriert: 27.02.2005 13:05
Beiträge: 1194
Yesterday i got the 2.3.13. Today the 2.3.14 without announcment??

_________________
hifi war gestern, hifidelio ist heute!


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 09:34 
Offline
Benutzeravatar

Registriert: 22.02.2007 01:03
Beiträge: 441
They fixed a bug in the DAAP client.
See http://www.hifidelio-user.de/viewtopic.php?t=3395

_________________
the Rough Guide to the Hifidelio has become part of The Well Tempered Computer


Nach oben
 Profil  
 
 Betreff des Beitrags: Re: Music folder
BeitragVerfasst: 06.04.2007 10:05 
Offline

Registriert: 19.01.2005 23:28
Beiträge: 84
Vincent hat geschrieben:
A month ago I bought a HF.
It came with firmware 2.3.8
Now I'm running 2.3.14
As 14 minus 8 is approximately 6, I had to change smb.conf 6 times.
To backup the HF to my NAS I simply need read access to the music folder.

Would you please, please, please consider making it readable over the network by default.

Coming back to your backup-issue. From your other posts I understand the following:
- you have modified your HF with a 400G harddisk
- you don't like the idea of backups to an USB-drive
- you have an Iomega Storcenter 1TB

AFAIK - newer versions of the StorCenter firmware support the ftp protocol. Thus you would be able to backup your music-library to this ftp-server. All file-names would be preserved as they are stored inside the HF. You can also do incremental backups.
I do my backups this way with the help of a little perl-script. I still need a telnet session to prepare the list-files and to start the script.
If you are interested in - let me know.

Vincent hat geschrieben:
btw: is a backup of the music folder sufficient or should one backup the database as well?

I recommend a backup of the database - and the playlists as well. However, as long as you do backups via the SMB-export it's not needed. You have to re-import your backed-up files anyway. It would only help in case of such ftp-backup or the also mentioned rsync-method to an USB-drive.


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 10:42 
Offline
Benutzeravatar

Registriert: 22.02.2007 01:03
Beiträge: 441
Zitat:
- you have modified your HF with a 400G harddisk


No, its the biggest you can buy from Hermstedt (in the USA their is an Olive with 700 Gb)

Zitat:
you have an Iomega Storcenter 1TB

Yep

Zitat:
newer versions of the StorCenter firmware support the ftp protocol

Mine is brand new. The problem is as soon as you load a lot of files the firmware fails, you can't even make a share or activate FTP. The music servers hangs, etc. I expect a replacement unit next week but I'm afraid it runs the same lousy firmware. But one can make a backup.

Zitat:
If you are interested in - let me know.

Shure, sounds good

Zitat:
I recommend a backup of the database - and the playlists as well. However, as long as you do backups via the SMB-export it's not needed. You have to re-import your backed-up files anyway. It would only help in case of such ftp-backup or the also mentioned rsync-method to an USB-drive.

A bit dark to me, would you be so kind to clarify?
Do I understand correctly that all information in de database is written into the tags in the music files (regardless of the format).
If one do a restore straight in to the music folder and use the maintanace functie (read met info) would that work?

_________________
the Rough Guide to the Hifidelio has become part of The Well Tempered Computer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 12:21 
Offline

Registriert: 19.01.2005 23:28
Beiträge: 84
Vincent hat geschrieben:
Zitat:
- you have modified your HF with a 400G harddisk

No, its the biggest you can buy from Hermstedt (in the USA their is an Olive with 700 Gb)

Ooops, I did not know that...
Vincent hat geschrieben:
Zitat:
newer versions of the StorCenter firmware support the ftp protocol

Mine is brand new. The problem is as soon as you load a lot of files the firmware fails, you can't even make a share or activate FTP. The music servers hangs, etc. I expect a replacement unit next week but I'm afraid it runs the same lousy firmware. But one can make a backup.

Mmmh, a backup-unit should be reliable. However, I wouldn't expect much from those additional features like music-server etc. That's what the HF is for, isn't it?
As long as the ftp access works it's sufficient. The perl-script will only put file by file to the backup-directory so you can leave the process unintended - I never had any errors!

Vincent hat geschrieben:
Zitat:
If you are interested in - let me know.

Shure, sounds good

OK, I will explain shortly what to do.
On your ftp-server
1) Create the ftp-account - an anonymous access is sufficient, however, you can create a usr/password account if you like.
2) Create the backup-directory on your ftp-server (e.g. backup/music)
3) Note ip-address, backup-dir, user-access

Hifidelio-import-folder:
4) Create a directory in your import-folder "backup"
5) Copy the perl-script to your import-folder - you have to edit $host_name, $login_name, $password, $remote_dir

Hifidelio-telnet-session:
6) Login to your HF
7) make the script executable:
Code:
root@hifidelio:~# chmod 0777 /audio/import/backup/music_bu.pl

8 create a list-file of you files you wish to backup, full backup:
Code:
root@hifidelio:~# find /audio/music/ > /audio/import/backup/all_20070405.lst

9) An incremental backup would look like:
Code:
root@hifidelio:~# find /audio/music/ -newer /audio/import/backup/all_20070405.lst > /audio/import/backup/diff_20070405_20070406.lst

10) Start the perl-script and do the backup(-test):
Code:
root@hifidelio:~# /audio/import/backup/music_bu.pl --bu-infile=/audio/import/backup/all_20070405.lst --verbose --test

11) If the output looks like:
Code:
HIFIDELIO backup utility
  Version:        0.3
  Build-Date:     05.04.2007
Parameters:
  bu_infile:      /audio/import/backup/all_20070405.lst
  verbose-level:  2
  ftp-host:       192.168.65.7
  login:          anonymous
  password:       *********
  remote_dir:     /bu/hf/music
  HF-dir:         /audio/music
  test-mode:      YES
  tar-mode:       NO
Open ftp connection ...OK
Starting copy process of 6828 lines...
 16% (0.664 Mbytes)

you can run the script w/o the "--test --verbose" and go for a large cup of coffee...

Vincent hat geschrieben:
Zitat:
I recommend a backup of the database - and the playlists as well. However, as long as you do backups via the SMB-export it's not needed. You have to re-import your backed-up files anyway. It would only help in case of such ftp-backup or the also mentioned rsync-method to an USB-drive.

A bit dark to me, would you be so kind to clarify?
Do I understand correctly that all information in de database is written into the tags in the music files (regardless of the format).
If one do a restore straight in to the music folder and use the maintanace functie (read met info) would that work?

Yes, all tags are stored in the database. The database also contains the file-names as they are stored on the HF and each file has an unique ID. Playlists are stored seperately and referenced via ID's.
If you do a backup via the smb-shared folder you'll loose both the ID's and the file-names (SMB-shares corrupt some filenames and directory-names). However, you can still those files to re-import them to the HF in case of a restore.
The exact backup of the HF-music-folder via ftp (or rsync) however allows the backup/ restore of the data-base as well.
Code:
root@hifidelio:~# tar -czf /audio/import/backup/db_20070405.tgz /data/db/
You can store the tgz-file together with your music-data.

Hints and improvements:
- the perl-script could be extended to skip 8..10 and do it automatically
- the backup of the db could also be included to the script
- if you don't like the "backup" folder in your import-directory rename it to ".backup"

-------------
I hope that no admin will blame me for the large message - here is the script (Edit 2007-07-22: update version 0.6):
Code:
#!/usr/local/bin/perl -w

use Net::FTP;

###############################################################################
#
# Hifidelio music-directory backup tool - see usage() for more information
#
###############################################################################


###############################################################################
#
# Changelog/Release notes
#
###############################################################################
#
# 2007-07-15: AJ
#  - v0.6
#  - FIX: corrected ftp-login typo
#  thx to Bastel:
#  - ADD: set ftp-binary-mode explicitely
#  - ADD: handling of ':'-char in filenames - replaced by ' '
#
# 2007-04-11: AJ
#  - v0.5
#  - corrected ftp-login parameter
#
# 2007-04-10: AJ
#  - v0.4
#  - removed unsupported tar-option
#  - some cosmetic changes
#
# 2007-04-05: AJ
#  - v0.3
#  - changed ftp-access to anonymous
#
# 2006-08-15: AJ
#  - v0.2
#  - added file size calculation
#
# 2005-12-05: AJ
#  General:
#  - 1st issue v0.1
#
#  Issues and limitations:
#  - ftp-access and backup directory need to be modified inside the script
#  - the performance depends on the network speed - not the perl-script itself!
#
###############################################################################




###############################################################################
# some globals
###############################################################################
my  $version                      = "0.6";                                # script version
my  $date                         = "2007-07-15";                         # script date

my  $bu_infile                    = "./backup.lst";                       # external file-list to be read
my  $test_only                    = '0';                                  # do not write to the backup folder
                                                                 
my  $verbose                      = '1';
                                                                 
my  $host_name                    ="192.168.65.7";               
my  $login_name                   ="anonymous";
my  $password                     ="-anonymous@";
my  $remote_dir                   ="/bu/hf/music";                        # consider NO trailing /
my  $hf_music_dir                 ="/audio/music";                        # consider NO trailing /
my  $hf_music_dir_depth           =(my @a=split(/\//,$hf_music_dir));     # and make the depth right now

my  $full_size                    = '0';

# some error-codes that can be checked by the caller
my  $NO_ERROR                     = '0';
my  $ERROR_USAGE                  = '-1';
my  $ERROR_NO_BU_FILE             = '-2';
my  $ERROR_WHILE_OPEN_BU_FILE     = '-3';
my  $ERROR_FTP                    = '-4';


sub usage
{
   my $message  = join ("\n", @_);
      $message .=  <<EOM

------------------------------------------------------------------------------
Program backups HF-songs via ftp.
(Ver: $version, Date: $date)
  Reads a given file-list and copies all files together with
  the appropriate directories directly.
  file-list generation example:
            find /audio/music -newer last_backup.lst > new_backup.lst

Usage: music_bu
                 --bu-infile=<backup-filelist-input-filename>
                 --verbose        --> increase verbose-mode
                 --quite          --> supress any (error-)messages
                 --test           --> do not write any files
                 --help           --> print this message

Example:

  music_bu --bu-infile=newer_than_20050718.lst

  The file 'newer_than_20050718.lst' will be handled. No output except
  error-messages will be generated. The result is according to exit.
------------------------------------------------------------------------------
EOM
    ;

  if ($verbose > 0)
  {
    print $message;
  }
  exit ($ERROR_USAGE);
}

sub error_exit
{
  my $error_code  = shift;
  my $message     = join ("\n", @_);
      $message  .=  <<EOM

------------------------------------------------------------------------------
Program terminating. Error code is ($error_code)
EOM
    ;

  if ($verbose > 0 )
  {
    print $message;
  }
  exit ($error_code);
}


###############################################################################
# main starts here
###############################################################################

# Did someone ask for help?  This overrides everything else.
usage() if grep {/^--help$/i} @ARGV;

# parse command line parameter
foreach my $arg (@ARGV)
{
  my $argname = $arg;
  my $value;
  $argname =~ /^--(\S+)=(\S+)/;     # cut between '='
  if ($2)                           # value given?
  {
     $argname = $1;                 # argname is 1st
     $value=$2;                     # value is 2nd
  }
  else
  {
     $argname = $arg;               # we did already a cut
     $argname =~ /^--(\S+)/;        # cut 1st parameter again
     $argname = $1;                 # store
     $value='';                     # value is not given
  }
  # now check for the commandline parameter; it's self-explaining
  if ($argname =~ /^bu-infile$/i) {
     if (!$value) {
       usage ("Error: missing argument for backup-file");
     } else  {
       $bu_infile = $value;
  }  } elsif ($argname =~ /^verbose$/i) {
    $verbose++;
  }  elsif ($argname =~ /^test$/i) {
    $test_only++;
  }  elsif ($argname =~ /^quite$/i) {
    $verbose=0;
  }
  else
  {
   usage ("Error: unknown parameter $arg");
  }

}
if ($verbose > 1)                         # messages required ?
{
  printf("\nHIFIDELIO backup utility \
  Version:        $version\
  Build-Date:     $date\
Parameters:\
  bu_infile:      $bu_infile\
  verbose-level:  $verbose\
  ftp-host:       $host_name\
  login:          $login_name\
  password:       *********\
  remote_dir:     $remote_dir\
  HF-dir:         $hf_music_dir\
  test-mode:      %s\
",($test_only ? "YES" : "NO")
);
}
# check whether the bu-file is given
if ( ($bu_infile eq '') )
{
  usage("Error: Backup-file needed.");
}
# check for valid files at the beginning
if ( $bu_infile)
{
    if (! -f $bu_infile) {
      error_exit ($ERROR_NO_BU_FILE,"\nError: Backup-file does not exist ($bu_infile): \n$!");
    }
}


# open bu-file
error_exit ($ERROR_WHILE_OPEN_BU_FILE,"\nError: Couldn't open backup-file ($bu_infile): \n$!") unless
    open (INFILE, "<$bu_infile");

if ($verbose > 1)                         # messages required ?
{
   printf("Open ftp connection ...");
}

my   $ftp;

$ftp=Net::FTP->new($host_name);           # open the ftp connection
error_exit($ERROR_FTP,"Could not open ftp connection to $host_name $!\n") unless $ftp;
 
$ftp->login($login_name ,$password);      # login
error_exit($ERROR_FTP,"Could not login to $host_name $!\n") unless $ftp;

$ftp->binary();                                 # Set mode to binray
error_exit($ERROR_FTP,"Could not set to binary mode $!\n") unless $ftp;

$ftp->cwd($remote_dir);                   # cd to remote dir
error_exit($ERROR_FTP,"Could not cd to $remote_dir $!\n") unless $ftp;

# now prepare the copy process
my   $line_num=`wc -l $bu_infile`;
$line_num =~ /^\s*(\d+)/;
$line_num = $1;

if ($line_num == 0)                       # prevent div by 0
{
   error_exit ($ERROR_WHILE_OPEN_BU_FILE,"\nError: Empty backup-file ($bu_infile): \n$!");
}

my $line_count=0;
$|=1;                                     # make prints w/ flush



if ($verbose > 1)                         # messages required ?
{
   printf("OK\nStarting copy process of %d lines...\n",$line_num);
}
 
###############################################################################
# we are now going to parse the list-file
###############################################################################

while (<INFILE>)
{
  chomp;
  if (($verbose == 1) || ($verbose == 2))
  {
#    print '.' ;                                                                              # print some stupid progress
    printf("\r%3d%s (%0.3f Mbytes)",($line_count*100)/$line_num,"%",$full_size/1024) ;        # print some stupid progress
#      print $_ . "\n";
  }
   $line_count++;
  next if /^\s*$/;                                        # Blank lines ignored.
   my   $src_file=$_;                                     # save
   my @arr = split(/\//,$src_file);                       # generate some elements
   my $len = @arr;                                        # get the number of directories
   my $title = $arr[$len-1];                              # the last element is our title

   my $dst_dir=$remote_dir;                               # start with remote dir
   for (my $i=$hf_music_dir_depth; $i<($len-1) ; $i++)    # make the dst_dir, skip over 2-element hf-music-dir
   {
      $dst_dir = $dst_dir."/".$arr[$i];   
   }

  if ($verbose > 3)
  {
     print $src_file."\n";
     print $dst_dir."\n";
     print $title."\n";
   }

   if (-d "$src_file")                                    # directory ?
   {
        my $size=(-s $src_file);
        if ($size % 1024)
        {
          $size/=1024;
          $size+=1;
        }
        else
        {
          $size/=1024;
        }
        $full_size+=$size;
        #printf("\nSize of $src_file is %d",$size);
   }
   else
   {
      if (-f "$src_file")                                 # file
      {
        if ($verbose > 2)
        {
          printf ("make $dst_dir \n");
        }
        if (!$test_only)
        {     
          $ftp->mkdir($dst_dir,1);                       # make remote dir
          error_exit($ERROR_FTP,"Could not mdir to $dst_dir $!\n") unless $ftp;
        }
        if ($verbose > 2)
        {
          printf("copy $src_file to $dst_dir \n");
        }
        if (!$test_only)
        {     
          $ftp->cwd($dst_dir);                                   # cd to remote dir
          error_exit("$ERROR_FTP,Could not cd to $dst_dir $!\n") unless $ftp;

          # Replace : character by space
          my   $dst_file=$_;                                     # save
          $dst_file = $title;
          $dst_file =~ s/:/ /;

          $ftp->put("$src_file","$dst_file");
          error_exit("$ERROR_FTP,Could not put file $src_file $!\n") unless $ftp;
          my $size=(-s $src_file);
          if ($size % 1024)
          {
            $size/=1024;
            $size+=1;
          }
          else
          {
            $size/=1024;
          }
          $full_size+=$size;
          #printf("\nSize of $src_file is %d",$size);
        }
        else
        {
        }
      }
      else
      {
        printf("Warning: Could not handle file-type $src_file\n");
      }
   }
}

  $ftp->quit;                                             # end ftp-session
  if (($verbose == 1) || ($verbose == 2))
  {
    printf("\r100%s done, %01.3f MBytes copied\n","%",$full_size/1024);      # print final progress
  }
 
exit(0);


Zuletzt geändert von aj145 am 22.07.2007 13:12, insgesamt 4-mal geändert.

Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 06.04.2007 12:55 
Offline
Benutzeravatar

Registriert: 22.02.2007 01:03
Beiträge: 441
Great stuff,

Thanks

Vincent

_________________
the Rough Guide to the Hifidelio has become part of The Well Tempered Computer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 14:09 
Offline
Benutzeravatar

Registriert: 14.03.2005 16:43
Beiträge: 313
Wohnort: Konstanz
hi aj145,
looks great,
if you make a full backup with tar over WLAN it will probably crash cause of file Size.
My Idea: make from each folder under music a tar file.
This would mean that after broken ftp you don't have to start on scratch.
I would like to prefer the tar cause of the filenames which are not supported under Windows etc..

Gruss Bastel

_________________
Ein sehr glücklicher Fidel Benutzer
mit Oder und konfigurierbarer Anzeige der Suchlisten der glücklichste Fidel Benutzer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 15:43 
Offline

Registriert: 19.01.2005 23:28
Beiträge: 84
Bastel hat geschrieben:
if you make a full backup with tar over WLAN it will probably crash cause of file Size.

Ooops, the --tar switch is still part of the script - but not supported anymore. It has fortunately no function - sorry for the mistake.
Bastel hat geschrieben:
My Idea: make from each folder under music a tar file.
This would mean that after broken ftp you don't have to start on scratch.
I would like to prefer the tar cause of the filenames which are not supported under Windows etc..

There is one simple reason for the unused tar-switch - when I started this script my first idea was a tar-file ;-) However, the script does only use ftp-commands what requires a ftp-server on the other side. So, no file-names will be crippled as long as ftp is used - whatever OS is used. Simply check it out. The only benefit of tar in this case would be preserved file-attributes like date, owner, access, etc. - but this is not really needed I guess. Btw - there would be no issue with the file-size as long as the underlaying file-system would support it.
If the ftp-connection gets broken during the backup-process you can do a "resume" by editing the file-list - not very convenient but it would do the job. One could also extend the script to handle this via a --resume switch - not really difficult to implement.

Note, I only wanted to show that it's quite easy to do a network-backup to a standard NAS via ftp - without the hassle of crippled file-names and smb-configuration. The reason why I use this method is also very simple - I'm too lazy to plug-in an USB-drive and do the backup via USB ;-)


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 15:46 
Offline
Benutzeravatar

Registriert: 14.03.2005 16:43
Beiträge: 313
Wohnort: Konstanz
Thanks aj145
I'll give it y try.
Gruss Bastel

_________________
Ein sehr glücklicher Fidel Benutzer
mit Oder und konfigurierbarer Anzeige der Suchlisten der glücklichste Fidel Benutzer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 16:04 
Offline

Registriert: 19.01.2005 23:28
Beiträge: 84
I've updated the script to v0.4. Thanks Bastel for pointing out the unsupported tar-switch.


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 20:44 
Offline
Benutzeravatar

Registriert: 14.03.2005 16:43
Beiträge: 313
Wohnort: Konstanz
Hi aj145,
works great after following mod:
line 217
Code:
$ftp->login("anonymous","-anonymous@");   # login

change to
Code:
$ftp->login($login_name ,$password);   # login


Thanks

Gruss Bastel

_________________
Ein sehr glücklicher Fidel Benutzer
mit Oder und konfigurierbarer Anzeige der Suchlisten der glücklichste Fidel Benutzer


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: 10.04.2007 23:15 
Offline

Registriert: 19.01.2005 23:28
Beiträge: 84
Bastel hat geschrieben:
works great after following mod:
line 217
Code:
$ftp->login("anonymous","-anonymous@");   # login

change to
Code:
$ftp->login($login_name ,$password);   # login

:oops: It's corrected already. :oops:

Thanks for testing.

Cheers,
Andreas


Nach oben
 Profil  
 
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 20 Beiträge ]  Gehe zu Seite 1, 2  Nächste

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.

Suche nach:
Gehe zu:  
cron
Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de