Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: FoobarSync - official disussion thread (Read 18159 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FoobarSync - official disussion thread

For anyone that is looking for a possibillity to synchonize Foobar2000 items to different PMPs / MP3-players, Network paths, USB-sticks:
I had the same problem finding a solution for years and now did my own solution with FoobarSync.
Check out http://foobarsync.lima-city.de !

This thread here is for asking questions and feedback.

FoobarSync - official disussion thread

Reply #1
great
Will try one of these days.

There was an old plugin named "Send To Device" with almost same purpose, less flexible. Great that you rebuild something.

FoobarSync - official disussion thread

Reply #2
Think I better add some information so people can find it by forum search...

What it does
FoobarSync is an command line driven VBscript which will synchonize parts from your Foobar2000 Medialibrary and Playlists to one or more targets in a very flexible way.

Lets say you have a USB-Stick for your car entertainment system plus an Android device. Sure you want to have some music in your car and on your Android. But your car only accepts MP3 and needs a special folder-layout while your Android device plays many formats, but you want to save space and therefore want lower bitrates. And at least you want to have different albums and playlists in your car then on your Android. FoobarSync will help you to meet those demands plus more.

FoobarSync will get a subset of items from your Medialibrary AND your playlists, defined by a search-query and other rules. The selected items can be defined per target (one configuration file per target). This configuration file is stored in the root folder of the target. When synchronizing each item is checked against the defined rule sets and then a) copied to the target or b) converted to the target. If your subset (choosen items) in Foobar2000 changes, these changes will get synchonized as soon as you rerun FoobarSync.

Main features of FoobarSync, individual (per target/device):
  •     unidirectional delta-synchonization of Medialibrary and/or playlist items (Foobar 2000 -> multiple targets)
  •     selection of files/playlists to sync, based tags and regular expressions
  •     File/Folderlayout based on Foobars TitleFormat-Language
  •     copy or conversion based on tags and rules
  •     deletion of ophaned files
  •     limits based on size, free space, max files
  •     multiple search&replace
  •     nearly all codecs and container formats based on FFmpeg supported
  •     statistics and preview
  •     Command line interface (no GUI for now! Contact me if you like to design one).


Next version is ready for download: 0.9.2
   - fixed minor bug where processes did remain in memory.
   - optimized target preparation prior to analyse.
   - finished implementation of ""MinSpace""
   - implemented orphaned file count (needed for ""MinSpace"")
   - redesigned code for deletion of orphaned folders
   - improved statistic summary
   - many minor improvements
   - code cleanup


FoobarSync - official disussion thread

Reply #3
Think I better add some information

Thank you for the info and for developing and sharing this.
Quis custodiet ipsos custodes?

FoobarSync - official disussion thread

Reply #4
Question to Users of FoobarSync:
Could anyone please test sync with an iPhone / Android device connected via USB and give me feedback?
This is related to Wiki/Sync to Linux/Android
I would do it, but my Android is.. well.. special because it's rooted and I've many security thing done to secure data on it.

Thanks a lot!

FoobarSync - official disussion thread

Reply #5
I can't test the whole setup because after executing the script I get an error saying that it can't connect to the COM server. I have installed "foo_comserver2-0.7-setup.exe", started foobar2000 and executed the script (as admin). Foobar2000 is 1.3.8.

I am not familiar with MS Scripting - is there anything specific to do after the installation of the COM server?

P.S. Checked the foobar2000 preferences: Com server is running.

Code: [Select]
C:\Program Files (x86)\foobar2000>cscript sync.vbs tasks=mptr
Microsoft (R) Windows Script Host, Version 5.8
Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten.
FOOBARSYNC 0.9.2 - Sync MediaLibrary and Playlists from Foobar2000 to tar
http://foobarsync.lima-city.de
Processing search for configuation files in root of drives D-Z...
*** PROCESSING 'L:\tutorial.id' (Synchronization tutorial)
Connecting to Foobar2000 Comserver / launch  Foobar2000 ...
ERROR:No connection to Foobar2000! Foobar Comserver not set up correctly?

FoobarSync - official disussion thread

Reply #6
Hi kbaerwald,

thanks for your feedback!
I'll try to help you solving this issue.

  • As far as I can see you are running Windows 7, right?
  • Take a look into your foobar2000 -> preferences -> components. Does 'COM Automation Server 07 alpha 6' is listet as component?
  • Have you tried to run the script when foobar2000 is running? I've had the problem, that foobar2000 did not start automatically on script execution.
  • Some anti-malware software could block the COM Server. Check your log-files there if so.
  • You could try to reinstall COMserver with administrative privilleges (right-click setup-exe -> run as administrator).
  • Next thing to try: Register the server manually with the command line 'foobar2000.exe /regsvr:comserver2'


Please give feedback here if this solved your problem (with details) or not.
Thanks for sharing!

FoobarSync - official disussion thread

Reply #7
Hi knilch - here we go (thanks for your help)

  • As far as I can see you are running Windows 7, right?
    Right
  • Take a look into your foobar2000 -> preferences -> components. Does 'COM Automation Server 07 alpha 6' is listet as component?
    Yes - exactly
  • Have you tried to run the script when foobar2000 is running? I've had the problem, that foobar2000 did not start automatically on script execution.
    This is how I understood your tutorial - have foobar2000 running first then start the script - yes!
  • Some anti-malware software could block the COM Server. Check your log-files there if so.
    Running security essential only, do not see anything in the logs
  • You could try to reinstall COMserver with administrative privilleges (right-click setup-exe -> run as administrator).
    Yes - deinstalled and re-installed COM server with admin rights
  • Next thing to try: Register the server manually with the command line 'foobar2000.exe /regsvr:comserver2'
    Yes - tried it


I tried it a second time without starting foobar2000 first - hurrah it worked (see below). If the script invokes foobar2000 it starts and the script finds the COM server. I will continue to test and come back to you shortly!

Code: [Select]
*** PROCESSING 'L:\tutorial.id' (Synchronization tutorial)
Connecting to Foobar2000 Comserver / launch  Foobar2000 ...
Preparing target for analysis...
Processing 11 items in MediaLibrary...
Analysing 13 items in 1 playlists (out of 106 items in 3 pl
Searching target for ophaned files and folders...

ANALYSIS DONE: 'L:\tutorial.id':
Items that were ignored by rule..: 0
Items that were ignored by error.: 0
Ophaned files to delete..........: 0 (0 MB)
Existing items don't need action.: 0 (0 MB)
Copy queue - items to copy.......: 0 (0 MB)
Convert queue - items to convert.: 24 (69 MB ca.)
SUM OF AUDIO ITEMS AFTER SYNC....: 24 (69 MB ca.)

Free space now...................: 15248 MB
Free space after sync............: 15179 MB

You may now take a look on the target to check the file/fol
(you can disable this pause with parameter 'NoPause'

ENTER=continue with synchronization    S=STOP and quit >>

FoobarSync - official disussion thread

Reply #8
That's great!
I think the COM Server setup is a bit buggy. It would be interesting to see, what finally helped you to get it run. As I already said, I had some trouble with autostarting foobar2000 on script execution. Before, I also had no luck at all with the setup. But at least I managed to get it up 'n running on 2 different computers - but I have no idea how I managed that, haha!  !
What I can say for sure is: The COM server - once successfully set up - works reliable without negative impact to foobar2000 itself.

FoobarSync - official disussion thread

Reply #9
Hello! First of all THANK YOU FOR MAKING THIS PLUGIN!!! There are no other alternatives for syncing to a usb device. However I was wondering what is planned for a gui interface, maybe similar to the foo_dop plugin. I believe you would have a larger user base for the plugin as it would be more appealing and user friendly. I want to try the current build that you have with a flash drive before I rockbox my iPod classic and use this baby for my entire library. But once again thanks!

FoobarSync - official disussion thread

Reply #10
Hey Kluch!
Thanks a lot for requesting a GUI. As I have already written in the FoobarSync Wiki, I would appreciate if anyone is willing to develop a GUI for my script!

I will focus my spare time on developing the pending changes and some functional feature requests from future posts here. Reason is, that I've litte exerience in Visual Studio and other GUI-orientated develop environments.
I'm the command line / scripting oriented guy. I love to fullfill my personal - some times very special - needs in that way. My approach for FoobarSync was, that I wanted to have an target-individual synchronization, that can easily be triggert by any other application like schedulers or event handlers like 'USB-Device connected'. With the current release my personal needs are fullfilled. Because coding is a hobby, I will keep on tweaking and expanding functionallity.

The way I designed the script offers much opportunities to use it, also in foobar2000s' GUI.
Example: Use components ColumnsUI plus Run Command and simply add a button in foobar2000, that you can click to start sync to a connected device. Need support for this or other configurations? All it needs is to ask here for the way, how to solve a needed feature. I am sure, that forum readers will share their experience then. And if I (or someone) thinks the solution useful, this person may add a tutorial or similar to the Wiki. If it's a functional extension, it may take me just a few minutes to implement it. And I will do so, if I find it useful.

So keep on asking questions! 

FoobarSync - official disussion thread

Reply #11
Hey Kluch!
Thanks a lot for requesting a GUI. As I have already written in the FoobarSync Wiki, I would appreciate if anyone is willing to develop a GUI for my script!

I will focus my spare time on developing the pending changes and some functional feature requests from future posts here. Reason is, that I've litte exerience in Visual Studio and other GUI-orientated develop environments.
I'm the command line / scripting oriented guy. I love to fullfill my personal - some times very special - needs in that way. My approach for FoobarSync was, that I wanted to have an target-individual synchronization, that can easily be triggert by any other application like schedulers or event handlers like 'USB-Device connected'. With the current release my personal needs are fullfilled. Because coding is a hobby, I will keep on tweaking and expanding functionallity.

The way I designed the script offers much opportunities to use it, also in foobar2000s' GUI.
Example: Use components ColumnsUI plus Run Command and simply add a button in foobar2000, that you can click to start sync to a connected device. Need support for this or other configurations? All it needs is to ask here for the way, how to solve a needed feature. I am sure, that forum readers will share their experience then. And if I (or someone) thinks the solution useful, this person may add a tutorial or similar to the Wiki. If it's a functional extension, it may take me just a few minutes to implement it. And I will do so, if I find it useful.

So keep on asking questions! 


Okay thanks!!! Also I'd love to help but I have very little coding background (basic Java) and don't really know gui integration either. But once again, huge contribution!!! Thanks

FoobarSync - official disussion thread

Reply #12
New Version 0.9.5 released!
  • renamed MaxTitles to MaxItemsOnTarget
  • renamed MinSpace with ReserveFreeSpace
  • implemented ignore as new option in SyncRules (paramter 3)
  • match between SyncRules and ConvertFormats now is case insensitive.
  • new Queue-file for FilesOK to support future detailed reports
  • fixed 'ERROR:RemoveOphanedFiles:File ...'
  • added some basic plausibility checks for configuration file sections
  • improved overall error trapping and handling of warnings

FoobarSync - official disussion thread

Reply #13
Version 0.9.8 is out with major changes and improvements.
Several changes in configuration file sections were made.
If you update from older version make sure to check out the changelog
and take a look at 'tutorial.id' in downloaded zip-file.



FoobarSync - official disussion thread

Reply #14
Ahhh, thank you so much for this plugin! It works swimmingly with my Rockbox'd iPod. I'm so happy with it! Thank you again for your hard work.

Just a quick side note, I had a couple of problems performing the test analysis for the first time. This is what would happen:



After poking around, I realized that I didn't have the proper permissions to read/write to my iPod and that it didn't like certain playlist names. I only figured this out by poking around the code and printing out stuff to the console. Is it possible to implement error messages? Or did I somehow miss something in the documentation that covers these issues? Many apologies if that is the case.

Also, I'm not an expert when it comes to tagging so sorry for my ignorance. I have a lot of Arabic, Korean, Mandarin, and Japanese songs. After syncing, a lot of the files names don't show any foreign characters at all. How do I know if the files are tagged/named using Unicode and how do I make sure it's in Unicode?

Once again, thank you a billion times!

FoobarSync - official disussion thread

Reply #15
After poking around, I realized that I didn't have the proper permissions to read/write to my iPod and that it didn't like certain playlist names. I only figured this out by poking around the code and printing out stuff to the console. Is it possible to implement error messages? Or did I somehow miss something in the documentation that covers these issues? Many apologies if that is the case.


erzadel,
  • debug-level for console output is controled with command line option debuglev.
  • playlist selection is controled per configuration file with PLselectRegEx
    to see which playlists match / do not match PLselectRegEx, you can use the Console Prompt
    ('ENTER=Continue  S=STOP!  C=Console')
    It may be helpful to use a online regex-tester when playing around with PLselectRegEx
Also, I'm not an expert when it comes to tagging so sorry for my ignorance. I have a lot of Arabic, Korean, Mandarin, and Japanese songs. After syncing, a lot of the files names don't show any foreign characters at all. How do I know if the files are tagged/named using Unicode and how do I make sure it's in Unicode?


  • The allowed character set for folder- and filenames is controled with WhiteListChrs.
    But I don't know how to allow arabic unicode characters here.
    Again a online regex-tester could help to to find out correct settings.
  • If items in your playlists are missing or do not play:
    The encoding INSIDE your m3u-files is controled with PLfileFormat.
Hope this helps! Because I am German I do not have much experience with unicode - so any feedback about your issues is welcome.

FoobarSync - official disussion thread

Reply #16
For the Whitelist I've found following:

"The secret to making Unicode regular expressions manageable lies in the \p[category] construct, which matches any character in the named Unicode character category...The high-level Unicode categories are Letters (L), Marks (M), Numbers (N), Punctuation (P), Symbols (S), Separators (Z), and Others (O and C)"

So \p{L} for example will match any Unicode letter character.

Please give feedback about this hint.

FoobarSync - official disussion thread

Reply #17
Thanks for making this script - something I've needed for ages!

Unfortunately I'm falling over on the tutorial, where I get this error:

ERROR:CreateFLAGfile: Access denied: 'c:\ConvertJobFlag.1'

Presumably the script doesn't have write access to c:\ - Can I make the script use elsewhere as a temporary store? I'd rather not let it use the root of my main drive.

FoobarSync - official disussion thread

Reply #18
The changes you asked for are done in a the new release:

  • minor bug fixed: nopause caused script so pause endless
  • Flagfiles for conversion control have moved from c:\ to folder where sync.vbs is executed
  • ffprobe.log has moved from c:\ to folder where sync.vbs is executed
    (used if parameter #5 of ConvertFormats has value '?')




FoobarSync - official disussion thread

Reply #19
The changes you asked for are done in a the new release:

  • minor bug fixed: nopause caused script so pause endless
  • Flagfiles for conversion control have moved from c:\ to folder where sync.vbs is executed
  • ffprobe.log has moved from c:\ to folder where sync.vbs is executed
    (used if parameter #5 of ConvertFormats has value '?')


Fantastic - this works perfectly now, and i'm busy filling up my mp3 player. Thanks!

FoobarSync - official disussion thread

Reply #20
Wow!!!!!

First let me say, coming from a 20 year developer, that looks like a whole world of pain.

The fact you were able to put that script together, I can't imagine how good you would actually be in a proper modern development environment.

I think as you maintain this, you will learn the lessons first hand which led to the development of modern development tools.

I wish you the best of luck in your maintenance.

I pass the following command line and it still processes the playlists. Am I missing something?

cscript sync.vbs task=mt runid="G:\"

FoobarSync - official disussion thread

Reply #21
I pass the following command line and it still processes the playlists. Am I missing something?

cscript sync.vbs task=mt runid="G:\"


Figured it out. I was using task instead of tasks.

You may want to consider throwing an exception if an unrecognized parameter name is passed in.

Cheers, and again wow!

FoobarSync - official disussion thread

Reply #22
Hi!
Thanks for a such handy tool!

I have a "little" trouble. My situation:

1. Audio files at network attached storage (NAS) and albums are SINGLE *.ape or *.flac or something other with *.cue. So i dont want to waste my HDD with files, which i already have at NAS. Nevermind when this single lossless files located, i think...
2. Foobar2k playlists created with cuesheet usage
3. When i try to sync playlists, there is error in ffprobe.log:
Code: [Select]
ffmpeg started on 2015-10-03 at 16:03:37
Report written to "c:\Program Files (x86)\foobar2000\ffprobe.log"
Command line:
"c:\\Program Files (x86)\\foobar2000\\ffmpeg.exe" -y
-i "H:\\synctest\\Iron Maiden\\Studio Albums\\1992 - Fear Of The Dark (TOCP-7155)\\Iron Maiden - Fear Of The Dark (TOCP-7155).cue" -vn
-c:a libvorbis -ac 2 -q:a 5 "I:\\/MUSIC\\Heavy Metal\\Iron Maiden\\1992 - Fear Of The Dark (TOCP-7155)\\12 - Fear Of The Dark.ogg"
ffmpeg version N-75573-g1d0487f Copyright © 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs
--enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  2.100 / 55.  2.100
  libavcodec    57.  3.100 / 57.  3.100
  libavformat    57.  2.100 / 57.  2.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter    6.  9.100 /  6.  9.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample  2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument 'H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\
Iron Maiden - Fear Of The Dark (TOCP-7155).cue'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'libvorbis'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '2'.
Reading option '-q:a' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '5'.
[b]Reading option 'I:\/MUSIC\Heavy Metal\Iron Maiden\1992 - Fear Of The Dark (TOCP-7155)\12 - Fear Of The Dark.ogg' ... matched as output file.[/b]
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue.
Successfully parsed a group of options.
[color=#FF0000][b]Opening an input file: H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue.
[AVIOContext @ 03e2eac0] Statistics: 1682 bytes read, 0 seeks
H:\synctest\Iron Maiden\Studio Albums\1992 - Fear Of The Dark (TOCP-7155)\Iron Maiden - Fear Of The Dark (TOCP-7155).cue: Invalid data found when processing input[/b][/color]

Test playlist and playlist item properties here.

I think we need to parse .cue. FFMpeg can't extract one track from .flac even we have parameters from playlist item (file path, duration, referenced file and referenced offset), as i know.
So we need multiformat tool which can extract single track from lossless containers such as  WAV, FLAC, APE, LossyWAV, ALAC, TTA, and WavPack  And this tool must do it from CLI. Cuetools can't do this as i know...

Please, help! I don't want to convert all albums i have to a single files, because it downloaded with torrent and seeding now...

P.S. Sorry for my bad English.

FoobarSync - official disussion thread

Reply #23
omgiafs,

I am sorry but processing a CUE-file is out of scope for this project.
I suggest you look for a tool that cuts the big flac-file into tracks. I bet ffmpeg IS able to do this but there should be some tools with GUI out there.
After you have single files, you will be able to use FoobarSync the usual way.

Good luck!

FoobarSync - official disussion thread

Reply #24
Hey,

thanks a lot for foobarsync. That's exactly what I am looking for. I am using foobar2000 (which works really good in wine (windows emulator) on Ubuntu. Now Im trying to get foobarsync to work in wine as well. Seems like something goes wrong but I have no clue what it is.

com automation server seems to be installed (according to foobars component list)

I am able to start cscript.exe in cmd. but when I go to foobar's directory and try to run "cscript sync.vbs tasks=mptr" nothing happens. No error occurs, nothing. There is just the next line with the blinking cursor waiting for me to type my next command.

Any clue whats going wrong?

EDIT
Okay, found a solution: Somehow it doesn't work for me to go to foobar's directory and then use cscript. It is also possible to stay in C:\windows\system32 with the following command (quite simple...): cscript "C:\Program Files (x86)\foobar2000\sync.vbs" tasks=mptr