Coder Social home page Coder Social logo

naggie / crates Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 1.14 MB

2013: Crates, a media database with immutability, federation and filesystem mapping, playlists for DJing

License: MIT License

Python 64.10% HTML 4.45% CSS 7.67% Nginx 1.82% JavaScript 21.95%

crates's Introduction

Hey, you might want to check out my website for more about me and my projects.

crates's People

Contributors

jimjibone avatar naggie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

crates's Issues

gulp + watcher for asset bundling

build.js is slow and doesn't watch. We need moar gulp goodness for faster rebuilds and watching, especially if only CSS or JS is build depending on what changes.

We'll need to keep the current behaviour regarding NODE_ENV also. An observation: in production mode it takes 4x as long to build but the app loads and responds way faster of a simulated 4G connection using chrome devtools.


  • gup streaming
  • gulp sass
  • watching
  • babel (es6, JSX)
  • ...source map (dev)
  • uglifyjs (production)

Condensed queryset API

We can currently filter (AND) but we can't sort or do an OR search. I don't think the latter can be helped, but the former can be a special parameter: order_by so a query looks like this:

/albums/?name__istartswith=D&order_by=name
or
/albums/?name__icontains=D&order_by=artist

-- the directory part of the URL could correspond to a model subset.

Overview page

Analysis of collection: eg,

  1. display 1212 of 9000 music files are low quality.
  2. run jobs to improve/crawl/add/analyse etc
  3. Peer information

...etc

Player

We need a player. Following the discussion on boards and this weekend, I'm going to implement a horizontal one on the bottom -- we can try it and replace if it does not work out.

In terms of how we handle what we're playing, or play next I have an idea, looking at Deezer. It seems that you can play an album by clicking on it -- the cursor (and context) is directly on the page.

We could treat playlists in exactly the same way (deezer also does this). Adding to a playlist could be an option.

image

How do we deal with broken albums???

"Fast jungle music" from Hospital (no less) identifies as about 15 separate albums. It appears the album artist field is not used.

iTunes has the same problem!

Really, Hospital Records should get their act together; but I suspect we'll see this again.

@jimjibone any ideas?

Some of mine:

  1. Study headers and come up with a better alternative subset
  2. Use a hash of the cover art (won't work for all compilations)

cas url: optional extension

A ref does not contain a filename or extension. We should support one to enable correct mimetype -- simply append the extension to the URL:

http://localhost:8000/cas/00000...0000000.jpg

Cover art is broken for most files

MP3 files that I generated are OK, but practically all other files don't yield cover art with the from_mp3 classmethod. I think I'm probably just using mutagen wrong.

Mime-type should be explicit or not matter -- either way, it's normalised to 256x256 jpg by utils.py

NPM shinkwrap

so vague dependencies are not loaded.
image
Well done, NPM.

JS API get method

We have it. Currently:

  • Grab a JSON object from a URL
  • ...with optional parameters
  • ...redirect to login if session expires
  • ...without using xhr.responseURL which safari does not support (fix safari) (or use different mech to detect session expiry)
  • fix error handling on no network (replace loading spinner with something,

Peer API auth middleware

We need to authenticate other Peers by the API key as middleware. (A Peer is another crates server authenticated by a user account)

Loudness war: LUFS check

each song should be analysed for LUFS, with a target of -14 like spotify or -13 like youtube.

To be used as part of the quality metric
https://en.wikipedia.org/wiki/LKFS
https://www.masteringthemix.com/blogs/learn/76296773-mastering-audio-for-soundcloud-itunes-spotify-and-youtube
http://productionadvice.co.uk/youtube-loudness/
https://www.sweetwater.com/insync/what-is-the-youtube-13-lufs-loudness-reference-level/

Could gamify this with a score for each song based on weighted metrics such as

  • loudness is acceptable (yes/no)
  • bitrate
  • metadata quality
  • album art quality
  • DRM/watermark found

ImmutableFile export for serialise

Could be a mixin that accepts a subset of keys.

Importantly, includes the class name in the class key. Returns a Dict that can be JSON serialised.

Could also define an import ClassMethod, however that should be the same as creating an instance without the extra key.

Analyse Job

ChromaPrint/BPM/Key -- I think we should do this as a batch job rather than on crawl time because it's time consuming. We also have a job running mech.

A DLL that returns the 3 things given a file path would be great!

ChromaPrint is already implemented in PyAcoustID using the DLL method btw. We could use that, or use @jimjibone 's library as it should be more efficient as I think it uses the same samples for all three things.

@jimjibone thoughts?

Parts:

  • bpm
  • chromaprint
  • musical (camelot or other) key
  • album art dominant colour

SCSS

I assume we should use SCSS. Any objections, @jimjibone ?

https://github.com/davidguttman/sassify would work nicely with our browserify flow. Especially as this allows us to require() scss files directly -- which makes sense because every react component will rely on an associated style anyway.

Multiple CD albums

Do we combine them into one 'Album'?

I think by the time it's in crates you've lost all concept of a shiny disc anyway.

It would involve a bit of magic -- removing CD number via regex -- which technically should not be in the album title anyway.

async job daemon

I already made a job/task runner, which I might keep or replace with celery. However Django "Channels" are now around which allows you to use websockets and run async jobs via a message queue. Channels is set to become part of Django in 1.10.

I want to look into using my existing jobrunner + channels instead of celery.

Thumbnail generation

Loading full resolution cover art over wifi is slower than it could be, particularly considering some are several megapixels.

Use Pillow with Lanczos resampling or something to generate a png

Album browser

Needs

  • an API view
  • react album component
  • flux stuff?
  • infinite-scroll paginator
  • A-Z button component
  • A-Z css
  • search component / API
  • search CSS
  • general placeholders for album art so document does not reflow per image (height is non-deterministic due to responsive design)
  • auto headings (Album artist or Alphabet letter etc, streamed via map reduce methods and inserting a h2 in a pure-u-1)

Javascript packaging/build system

  • I suggest browserify (commonjs, not AMD or ES6 modules), which is used by react. Ideally I would use ES6 modules but I don;t think it's worth it quite yet.
  • JSX needs transpiling into Javascript also.
  • For development it's possible to run the transpiler in the browser.

We may as well do this properly as it should be structured from the start, lest it become a nightmare to manage.

I think we need a build step for our JS assets. Ideally something that looks for changes and recompiles -- be it gulp (which I know @jimjibone likes) grunt, custom or vanilla browserify + react transpiler. http://christianalfoni.github.io/javascript/2014/08/15/react-js-workflow.html gives a good rundown.

@jimjibone, up for this?

We could have a (commonjs) module per logical react component, such as player, browser, whatever.

JSON object API

can either be RESTful with a path eg /audiofile/2213213 or expose the filtered ORM via the index.

or a hybrid: the above with the primary key

Search

We need search.

I think it should be a global thing, adjunct to the album /Album artist/ genre browser -- it should be able to return multiple classes of object intelligently -- Albums, tracks, genres, playlists.

Try Median perimeter based colour detection for album letterboxing

Whilst a k-grouping algorithm is used to get the dominant colour, which works OK, often the dominant colour isn't the background colour so that the scaled art is obviously letterboxed. Some art has a solid background. In this case, median perimeter detection will work better.

Your collection vs. all the songs in the world

If we want the peer backup solution to really work, and to deal with importing songs without prejudice, we need a method of defining "approved" songs per user to form a sub collection -- aside from playlists (crates) that is, which is separate.

Thinking about it -- we were discussing whitelists and blacklists. Then, I was browsing soundcloud an had an idea -- how about simply "liking" songs?

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.