Giter Site home page Giter Site logo

songsorter's Introduction

SongSorter

Purpose

My dad's local music was stored in a folder of 8,000 unsorted songs. Surprisingly, I couldn't find any programs for sorting music. However, I knew Python was good at file organization, so I spent a few days writing this program. In the end, it was able to sorted 8,000 songs in under a minute, which would otherwise be infeasible to sort manually.

Explanation

Firstly, I needed a way to read the metadata of each song. This turned out to be far more complicated than I hoped, so I tried a few different libraries and settled on Mutagen. Unfortunately, the documentation is pretty confusing, so my implimentation isn't as elegant as I had hoped. Regardless, it works.

For each song in the directory, the program uses this getMetaData() function to figure out the song's album and artist. If an artist\album path doesn't already exist, it creates one. Finally, it moves the file to that location.

During testing, I wanted a way to undo my work. 7Zip has a way of "flattening" a directory, but that takes a few minutes and a lot of mouse clicks, so I wrote flattenDirectory(). This function moves every song back to the parent directory and deletes every empty folder. In hindsight, this could have been more readable if done recursively.

To use it, you simply call either sortSongs(cwd) or flattenDirectory(cwd), where cwd is the address of your music folder.

songsorter's People

Contributors

mktwohy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.