topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • November 14, 2019, 05:43 PM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Automatically adding custom-folder music to iTunes 12.x +  (Read 3551 times)

dcsev

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 158
    • View Profile
    • Donate to Member
Automatically adding custom-folder music to iTunes 12.x +
« on: February 11, 2019, 12:37 AM »
Hi all,
I am sure if this is within the scope of DC, but it's worth a shot and it seems people all over the Internet want something like this. I can't believe no one has coded anything that currently works on the Internet for this.   The closest thing I've found is called "iTunesFolderWatch" located here: http://albumbrowser....larita.net/itfw.html, but it's not maintained, costs $, doesn't work, requires .NET 2.0 which i'm finding is difficult to find on the Internet, and most importantly NOT portable.

Basically, a lot of people like me keep their music in D:\ directory instead of the standard C drive just in case they need to reinstall. Unfortunately, iTunes does NOT allow you to "automatically" add music to its library, unless you use a very specific folder deep in the C drive.

Asks:
1. Program must watch a specific folder(s) and automatically adds the music to the iTunes library (like this pic: http://albumbrowser....larita.net/itfw3.png)
2. Must be lightweight
3. Must be able to minimize in tray
4. MUST be portable (pretty please!). All settings should be contained within the folder.


Is this a proper ask?
« Last Edit: February 11, 2019, 12:42 AM by dcsev »

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 701
    • View Profile
    • The Blind House
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #1 on: February 11, 2019, 10:10 AM »
@dcsev - I use Link Shell Extension for this - http://schinagl.priv...kshellextension.html
I keep my music on an external drive and just create a hardlink to the music folder on C:. Works great for me.

It doesn't give the tray alerts but is easy and simple.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #2 on: February 11, 2019, 11:03 AM »
I was actually working on something that would work for this, but life got in the way of finishing it.  Hopefully soon.  But there are a few alternatives out there to watch directories and then do things based on the directory changing.  An easy alternative is also PowerShell.  I have the following script running as my first step to creating that program.

Code: PowerShell [Select]
  1. ### 1. Setup folder to watch (it's currently set to the default download directory with my username commented out)
  2. ### 2. Should it watch subdirectories?  I have it set to false since my process copies to the subdirectories
  3. ### 3. Set file filters- I have it set to all files
  4.  
  5.     $dirWatcher = New-Object System.IO.FileSystemWatcher
  6.     $dirWatcher.Path = "C:\Users\<username>\Downloads"
  7.     $dirWatcher.Filter = "*.*"
  8.     $dirWatcher.IncludeSubdirectories = $false
  9.     $dirWatcher.EnableRaisingEvents = $true  
  10.  
  11. ### 4. Define your action for when an event is raised.
  12. ###    This is currently a multi-part action, logging it, then running my cleanup program
  13.  
  14.     $watcherAction =    {
  15.                             $path = $Event.SourceEventArgs.FullPath
  16.                             $changeType = $Event.SourceEventArgs.ChangeType
  17.                             $logEntry = "$(Get-Date), $changeType, $path"
  18.                             Add-content "C:\Users\<username>\Downloads\DirSweeper\log.txt" -value $logEntry
  19.  
  20.                                             [System.Diagnostics.Process]::Start("C:\Users\<username>\Downloads\DirSweeper\DirSweeper.exe")
  21.                         }
  22.  
  23. ### Decide which events to watch (I only watch for files being created)
  24.  
  25.     Register-ObjectEvent $dirWatcher "Created" -Action $watcherAction
  26. ###    Register-ObjectEvent $dirWatcher "Changed" -Action $watcherAction
  27. ###    Register-ObjectEvent $dirWatcher "Deleted" -Action $watcherAction
  28. ###    Register-ObjectEvent $dirWatcher "Renamed" -Action $watcherAction
  29.     while ($true) {Start-Sleep 5}

Just kill the window when you want to stop it.  That command I have in there to my other program can be anything that you want to script to do the copying.  Thanks to 4wd for getting me back into PowerShell scripting.


dcsev

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 158
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #3 on: February 12, 2019, 01:10 AM »
@dcsev - I use Link Shell Extension for this - http://schinagl.priv...kshellextension.html
I keep my music on an external drive and just create a hardlink to the music folder on C:. Works great for me.

It doesn't give the tray alerts but is easy and simple.

I didn't think of that. I suppose I could use a hard junction link to sync the directories without running the app.  I'll try this and see if it works.

dcsev

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 158
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #4 on: February 13, 2019, 01:33 AM »
Any chance of getting a lightweight app to do this?

The powershell seems like an inelegant solution. Might have to do the junction links, but I have no idea how iTunes will handle it. I don't keep itunes running 24/7 - only when I want to sync music to my phone.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #5 on: February 13, 2019, 07:01 AM »
As I said, I'm working on a more robust solution, but have been a bit busy at work.  Not sure if someone else is interested in making another solution.

There are also a number of synchronize applications that either run on a schedule or are resident.  FreeFileSync is one that is free.  Syncovery is one that I can personally recommend.   There are also programs that can monitor folders for changes, and those do the same as the PowerShell script, and some can launch other items, just like the PowerShell script.
« Last Edit: February 13, 2019, 07:55 AM by wraith808 »

dcsev

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 158
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #6 on: February 14, 2019, 02:02 AM »
@dcsev - I use Link Shell Extension for this - http://schinagl.priv...kshellextension.html
I keep my music on an external drive and just create a hardlink to the music folder on C:. Works great for me.

It doesn't give the tray alerts but is easy and simple.


i actually tried a junction link and it works, but now I'm running into another problem!  iTunes doesn't my m3u files  and has removed them from each in a new folder called D:\Music\ Not Added.
This has obviously ruined my Winamp setup that uses Album List to pull m3u files and present the CDs in their original playlist orders.

Without question, iTunes is the worst piece of softwar eApple has ever released.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,244
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #7 on: February 14, 2019, 05:17 PM »
Are your M3U files using relative or absolute paths?

If it's relative, try changing them to absolute.

Excluding the minimise to tray, RoboCopy, (included with every version of Windows since Vista and available for WinNT4.0+), covers the other three points.

Check every minute for matching files (*.mp3 *.ogg *.m4a *.flac *.m3u) and move them if there's at least one file change:
Code: Text [Select]
  1. robocopy.exe "C:\Downloads" "D:\Music" *.mp3 *.ogg *.m4a *.flac *.m3u /MOV /MON:1

Or copy:
Code: Text [Select]
  1. robocopy.exe "C:\Downloads" "D:\Music" *.mp3 *.ogg *.m4a *.flac *.m3u /MON:1

Send the output to a log or NULL if you're not interested in it, run it from Task Scheduler or GPEdit Startup scripts for when the system starts.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #8 on: February 14, 2019, 08:57 PM »
When I put an answer up in powershell, 4wd switches to robocopy  ;D :Thmbsup:

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,244
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #9 on: February 14, 2019, 11:25 PM »
When I put an answer up in powershell, 4wd switches to robocopy  ;D :Thmbsup:

Got to keep ya guessing  :P

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #10 on: February 15, 2019, 01:17 PM »
You could actually do a combination of the two; use robocopy for the command in the powershell script to only copy the file that changed.

dcsev

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 158
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #11 on: February 15, 2019, 01:21 PM »
The problem is I don't want to copy all of the music files. I thought I could get away from doing this with an app designed to add it to the iTunes.

The junction link worked, but unfortunately iTunes completely mutilated my carefully arranged collection that winamp relies on. ugh

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #12 on: February 15, 2019, 05:33 PM »
https://docs.microso...ws-commands/robocopy

Specifically:

/xo   Excludes older files.

Add that to the given command line and it should only copy new files.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,244
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #13 on: February 15, 2019, 06:10 PM »
You could actually do a combination of the two; use robocopy for the command in the powershell script to only copy the file that changed.

Or PoSh runs Robocopy /MON:1 as a wrapper, parses its Stdout, then outputs a Toast or Balloon Tip message for any action that occurred. ;)

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #14 on: February 15, 2019, 11:15 PM »
I thought about the balloon tip, but it would generate it for each change, which would be annoying IMO.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,244
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #15 on: February 16, 2019, 08:18 PM »
I thought about the balloon tip, but it would generate it for each change, which would be annoying IMO.

I would expect that something similar happens with the aforementioned iTunesFolderWatch but it's something that can be ameliorated by using RoboCopy's options, eg.
/MOT:10 = every 10 minutes
/MON:10 = every 10 matching file system changes

I was thinking more of parsing the stats that appear after an operation, this bit:

Code: Text [Select]
  1. .................Total    Copied   Skipped  Mismatch    FAILED    Extras
  2.     Dirs :         1         0         1         0         0         0
  3.    Files :        14        14         0         0         0         0
  4.    Bytes :  741.21 m  741.21 m         0         0         0         0
  5.    Times :   0:00:05   0:00:05                       0:00:00   0:00:00

Where you really only need the number of files copied, so it'd just say 'Added 14 files'.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,284
    • View Profile
    • Donate to Member
Re: Automatically adding custom-folder music to iTunes 12.x +
« Reply #16 on: February 17, 2019, 09:38 AM »
I'd only think that MOT would work because of the fact that the changes wouldnt necessarily be in even batches of 10