{"id":15631291,"url":"https://github.com/rj/playdar-core","last_synced_at":"2025-08-02T08:36:52.618Z","repository":{"id":679216,"uuid":"322930","full_name":"RJ/playdar-core","owner":"RJ","description":"Playdar - a content resolver for music","archived":false,"fork":false,"pushed_at":"2010-04-16T15:46:58.000Z","size":2818,"stargazers_count":192,"open_issues_count":23,"forks_count":17,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-08-01T17:08:10.048Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.playdar.org/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RJ.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-10-01T00:32:57.000Z","updated_at":"2024-01-19T14:28:21.000Z","dependencies_parsed_at":"2022-07-05T09:25:05.762Z","dependency_job_id":null,"html_url":"https://github.com/RJ/playdar-core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RJ/playdar-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RJ%2Fplaydar-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RJ%2Fplaydar-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RJ%2Fplaydar-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RJ%2Fplaydar-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RJ","download_url":"https://codeload.github.com/RJ/playdar-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RJ%2Fplaydar-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268355794,"owners_count":24237369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T10:39:50.115Z","updated_at":"2025-08-02T08:36:52.593Z","avatar_url":"https://github.com/RJ.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Playdar\n=======\nPlaydar is a music content resolver, written in Erlang, MIT licensed.\nIt's modular and can be extended using resolver scripts in any language.\nIt has an HTTP API to answer the question \"can i play this song?\".\nIf yes, you get a localhost URL that will play the song, from whichever souce\nplaydar resolved it to (plugins do the resolving).\n\nRead on for build instructions and an \"Understanding Playdar\" tutorial.\nMore information and binary installers / packages can be found at:\nhttp://www.playdar.org/\n\nBuilding\n--------\nTo build all the erlang code:\n\n    $ make\n\nTo build the collection scanner (needs taglib, g++):\n\n    $ make scanner\n\nRunning\n-------\n\n    $ ./playdarctl start-debug\n\nIn another terminal you can now do:\n\n    $ ./playdarctl numfiles\n    $ ./playdarctl scan \"/path/to/music\"\n    $ ./playdarctl numfiles\n\nThen check out http://localhost:60210/ and http://www.playdar.org/demos/\n\nUnderstanding Playdar\n=====================\n\nThe core playdar daemon is a generic content-resolver engine.\nIt contains a simple http server (Mochiweb), a resolver infrastructure, external\nmodule loader (plugins) and configuration management. \n\nPlaydar core allows you to dispatch queries and check query status, but by \nitself it can't resolve content. This is all handled by plugins.\n\nClients talk to Playar using the HTTP API. JSON is used for everything.\n\nResolver Queries\n----------------\nAll queries passed to Playdar are simply JSON objects of any shape or size. \nPlaydar checks for a \"qid\" propery - a GUID for the query, in each object,\nbut nothing else - it's up to the plugins to decode the query objects.\n\nIf a plugin doesn't recognise a query it simply ignores it.\n\nThe following examples are similar in syntax to how Playdar is built, but may\nnot necessarily be exactly correct. They serve to illustrate the query\nmechanics:\n\nMusic Query Example\n-------------------\nThe query object:\n{\n    \"qid\" : \"XXX123\",\n    \"artist\" : \"Big Bad Sun\",\n    \"track\"  : \"Sweet Melissa\"\n}\n\nThis is a simple query for a specific song. In this case, the default plugins\nthat ship with Playdar know how to handle it - because we're using Playdar as\na music content resolver. The library plugin will search your disk and respond\nwith a result if you have a copy of the song being searched for:\nA result object:\n{\n    \"sid\" : \"YYY456\",\n    \"qid\" : \"XXX123\",\n    \"result\" : {\n        \"url\" : \"/path/to/sweet_melissa.mp3\",\n        \"bitrate\" : 128,\n        \"duration\" : 283,\n        \"artist\" : \"Big Bad Sun\",\n        \"track\" : \"Sweet Melissa (live)\",\n        \"score\" : 0.89\n    }\n}\nIn the the above example, the library plugin reports a result for the query \nwith a score of 0.89 - it found a live version - but close enough.\nThe \"sid\" propery is a GUID for the result.\n\nResolvers can report multiple result objects for any query.\n\nNon-music Example\n-----------------\nDepending on the plugins loaded, Playdar could be used to resolve anything.\nHere's a fictional example query for an academic essay:\n{\n    \"qid\"    : \"XXX789\",\n    \"author\" : \"Jonathan swift\",\n    \"year\"   : 1729,\n    \"title\"  : \"a modest propsal\"\n}\n... and if you have a resolver plugin that could search for essays and academic\npapers, it might respond like this:\n{\n    \"sid\"    : \"YYY123\",\n    \"qid\"    : \"XXX789\",\n    \"result\" : {\n        \"author\" : \"Jonathan Swift\",\n        \"year\"   : 1729,\n        \"title\"  : \"A Modest Proposal\",\n        \"score\"  : 1.00,\n        \"category\"   : \"humour\",\n        \"url\"    : \"http://art-bin.com/art/omodest.html\"\n    }\n}\n\nIn this example, the resolver matched the query to an essay posted on the web\ninstead of the local filesystem. \n\nCustom Protocols\n----------------\nPlaydar ships with support for reading content from http:// and file:// URLs.\nThat is to say support for those protocols is implemented by plugins that ship\nby default.\n\nA resolver could provide an url like this: \"custom://abc123-modest-blah\" and\nregister itself as a handler for custom:// urls. This allows resolver plugins\nto fetch and stream content in any way they like. \nYou could add support for ftp:// or a custom p2p:// protocol if you wanted.\n\nHow Clients Fetch Results\n-------------------------\nThe actual URL to the resolved content, be it a local filesystem or http URL,\nis never exposed to clients using the Playdar HTTP API. The \"url\" propery is\nstripped out of result objects before they are returned to clients.\nThe \"sid\" GUID in every result object is used to request the content, like so:\n http://localhost:60210/sid/\u003csid\u003e\nPlaydar will then fetch the content using the appropriate protocol handler\ninternally (file, http, p2p, custom, etc), and respond to the client with a \nwell formed HTTP response. This means that clients only need to understand\nHTTP. The details of how content is fetched by Playdar are hidden from clients.\nClients don't need to know where or how you access your music. \nThe Playdar API lets them ask \"Can you play this song\". The details of where\nand how you access the song are kept private.\nTo reiterate: clients can't tell whether you are playing a song you have on\nyour local disk, or are streaming over the internet from some other service.\n\nHow webpages interact with Playdar\n----------------------------------\nDesktop apps can obviously just use the HTTP API on localhost without any \nspecial considerations. Webapps and anything running in the browser is \nsubject to the browser security model, specifically the \"same-origin policy\".\nThis means that you can't access content in a document loaded from a domain\ndifferent to the domain your javascript executes in.\n\nTo solve this problem, playdar uses JSONP callbacks. Instead of requesting\nhttp://localhost:60210/api/?method=stat\nand getting json in response, you inject a script tag into the dom like this:\n\u003cscript language=\"javascript\" \n        src=\"http://localhost:60210/api/?method=stat\u0026jsonp=my_callback\"/\u003e\nPlaydar responds with the json object wrapped in your padding:\n my_callback(...normal json response...);\nwhich then fires the my_callback function - voilia, cross domain RPC.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frj%2Fplaydar-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frj%2Fplaydar-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frj%2Fplaydar-core/lists"}