10 Replies - 1484 Views - Last Post: 22 February 2014 - 02:40 AM

#1 Tyrion101  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 26
  • Joined: 23-August 13

Is a program like this possible in C++?

Posted 08 February 2014 - 12:12 PM

I tried looking for a program like this on the web, but only found one, and it doesn't quite do what I want, so I thought I'd see if I could do it one better, I want to be able to search my pc for mp3s and other music files not in iTunes or in the cloud, already and add them. The problem with iTunes is it adds everything, even things that are already there, if you do it by folder, and I have far too many songs to do it by song, it would take me years, even if I had the time to take. Is anything like this possible? It doesn't need to be pretty, just organized and do the job.

Is This A Good Question/Topic? 0
  • +

Replies To: Is a program like this possible in C++?

#2 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Is a program like this possible in C++?

Posted 08 February 2014 - 12:44 PM

That's always bugged me about iTunes. Yes this is possible, and not very difficult. I'm sure you could even write a C++ program to search your drives for files with an .mp3 (or otherwise specified) extension, and then add them to your iTunes library, whilst cleaning out duplicates. I'm not sure how easy iTunes would make that for you, but there shouldn't be many huge hurdles.

I would write a recursive function which gets a list of all files/folders in a given directory. If it's a file, check the extension and handle accordingly. If it's a folder, call the function on that folder and do the same with all files/folders inside of it.

Edit: I made a similar application in C# out of my frustration with itunes. I'll share my directory scan function to give you an idea:

        //Recursive function to scan directory for .mp3 files
        private void scanDirectory(string directory, int depth)
        {
            if (depth <= DIRECTORY_SCAN_DEPTH)
            {
                string[] files = Directory.GetFiles(directory);
                foreach (string file_name in files)
                {
                    if (isMP3(file_name)) 
                    { 
                        files_to_add.Add(file_name);
                    }
                }

                string[] subdirectories = Directory.GetDirectories(directory);
                foreach (string subdir in subdirectories)
                {
                    // Do not iterate through reparse points
                    if ((System.IO.File.GetAttributes(subdir) & FileAttributes.ReparsePoint) != FileAttributes.ReparsePoint)
                    {
                        scanDirectory(subdir, depth + 1);
                    }
                }
            }
        }

This post has been edited by Ntwiles: 08 February 2014 - 12:59 PM

Was This Post Helpful? 1
  • +
  • -

#3 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1072
  • View blog
  • Posts: 4,532
  • Joined: 09-June 09

Re: Is a program like this possible in C++?

Posted 08 February 2014 - 07:10 PM

Ofcourse it's possible, however, I prefer doing tasks like this using a scripting language. It's your choice, but if I were to do this I would do it in python.
Was This Post Helpful? 0
  • +
  • -

#4 Ghlavac  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 519
  • Joined: 14-January 09

Re: Is a program like this possible in C++?

Posted 08 February 2014 - 07:56 PM

Either do this in a higher level language (C# or something of that like) or use C++ and bring in the boost filesystem library, as the recursive directory iterator will make the searching for MP3's job much easier for you.
Was This Post Helpful? 0
  • +
  • -

#5 Tyrion101  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 26
  • Joined: 23-August 13

Re: Is a program like this possible in C++?

Posted 10 February 2014 - 12:45 PM

I'm always up for an excuse to learn a new programming languege. I only chose C++ because it is what I am most familiar with.
Was This Post Helpful? 0
  • +
  • -

#6 Black_Epiphany  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 64
  • Joined: 02-February 14

Re: Is a program like this possible in C++?

Posted 10 February 2014 - 02:47 PM

I would recommend python for something like this.

This post has been edited by Black_Epiphany: 10 February 2014 - 02:47 PM

Was This Post Helpful? 1
  • +
  • -

#7 Xaos  Icon User is online

  • D.I.C Regular

Reputation: 50
  • View blog
  • Posts: 320
  • Joined: 20-November 13

Re: Is a program like this possible in C++?

Posted 10 February 2014 - 05:25 PM

For some fun, why stop at iTunes? Especially if you're using this to learn a language. allow the user to select what kind of file extension to search for and then move them to a folder(and allow folder creation from the program). And if itunes is different (I assume it is) program that in as well.
Was This Post Helpful? 0
  • +
  • -

#8 DaneAU  Icon User is offline

  • Great::Southern::Land
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,617
  • Joined: 15-May 08

Re: Is a program like this possible in C++?

Posted 10 February 2014 - 05:31 PM

Some years ago, iTunes completely butchered my collection of Music, not even sure what caused it but all the filenames were changed and it was a good old mess. I wrote a small application in C# (one of my first in that language) to iterate through all my drives, read the ID3 data and re-folder, rename and organise all my music again. It worked and was a pinch to implement (although due to the massive amount of data I did at the time run into some runtime memory issues, which I never corrected). C++ you can do this task. For the fun of it, I am now considering writing something in Perl, my music Bag Collection is really in need of some OCD. If interested look into the MP3::MP3



Could be interesting.
Was This Post Helpful? 0
  • +
  • -

#9 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Is a program like this possible in C++?

Posted 10 February 2014 - 10:09 PM

iTunes: Pissing off computer scientists since 2001.
Was This Post Helpful? 0
  • +
  • -

#10 DaneAU  Icon User is offline

  • Great::Southern::Land
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,617
  • Joined: 15-May 08

Re: Is a program like this possible in C++?

Posted 11 February 2014 - 05:37 AM

Personally I would not use it if I didn't have an iPhone & iPod... Shittiest media player ever. It eats my computer, fills it with crap and is just hideous to use. I take Windows Media Player over it any day of the week and that's saying something.
Was This Post Helpful? 0
  • +
  • -

#11 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1072
  • View blog
  • Posts: 4,532
  • Joined: 09-June 09

Re: Is a program like this possible in C++?

Posted 22 February 2014 - 02:40 AM

Quote

Personally I would not use it if I didn't have an iPhone & iPod... Shittiest media player ever. It eats my computer, fills it with crap and is just hideous to use. I take Windows Media Player over it any day of the week and that's saying something.


I recently converted to plex (a media server). I am in love with it so far. You set up your server, you manage your media in your own directory structure and plex parses the folder hierarchy and fetches all the metadata. You can then run plex clients on just about any mobile platform.

https://plex.tv/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1