{"id":19529564,"url":"https://github.com/beetbox/pylastfp","last_synced_at":"2025-04-26T11:35:22.099Z","repository":{"id":1019147,"uuid":"846770","full_name":"beetbox/pylastfp","owner":"beetbox","description":"Python bindings for Last.fm's \"fplib\" acoustic fingerprinting library","archived":false,"fork":false,"pushed_at":"2017-11-15T14:47:26.000Z","size":70,"stargazers_count":31,"open_issues_count":0,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-02T00:07:26.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://beets.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beetbox.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-08-18T17:48:02.000Z","updated_at":"2023-01-28T11:01:03.000Z","dependencies_parsed_at":"2022-07-06T02:01:12.904Z","dependency_job_id":null,"html_url":"https://github.com/beetbox/pylastfp","commit_stats":null,"previous_names":["sampsyo/pylastfp"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetbox%2Fpylastfp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetbox%2Fpylastfp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetbox%2Fpylastfp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beetbox%2Fpylastfp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beetbox","download_url":"https://codeload.github.com/beetbox/pylastfp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224034205,"owners_count":17244746,"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","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-11-11T01:25:56.816Z","updated_at":"2024-11-11T01:25:58.023Z","avatar_url":"https://github.com/beetbox.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a Python interface to Last.fm's acoustic fingerprinting library (called\n`fplib`_) and its related API services. It performs fingerprint extraction,\nfingerprint ID lookup, and track metadata lookup.\n\n.. _fplib: http://github.com/lastfm/Fingerprinter\n\n\nInstallation\n------------\n\nTo install, you will need a compiler and the dependencies required by fplib\nitself: `fftw`_ (compiled for single-precision floats) and `libsamplerate`_.\n(On Debian/Ubuntu, the packages are ``libfftw3-dev`` and\n``libsamplerate0-dev``.)\n\nOnce you have these, you can easily install from PyPI using `pip`_::\n\n    $ pip install pylastfp\n\nOr, if you don't have pip (or easy_install), head to the `download page`_.\nThe normal install command should work::\n\n    $ python setup.py install\n    \nTo build from the version control source (i.e., not from a release\ntarball), you will also need `Cython`_. (The source distributions include\nthe generated C++ file, avoiding the need for Cython. This package's\n``setup.py`` plays tricks to detect whether you have Cython installed.)\n\n.. _fftw: http://www.fftw.org/\n.. _libsamplerate: http://www.mega-nerd.com/SRC/\n.. _Cython: http://cython.org/\n.. _pip: http://pip.openplans.org/\n.. _download page: http://github.com/sampsyo/pylastfp/downloads\n\nThis library also depends on `audioread`_ to decode audio, although this\ndependency is technically optional. If you already have a mechanism for decoding\naudio files, there is no need to install audioread.\n\n.. _audioread: https://github.com/sampsyo/audioread\n\n\nRunning\n-------\n\nYou can run the included fingerprinter/lookup script, ``lastmatch.py``,\nto test your installation::\n\n    $ lastmatch.py mysterious_music.mp3\n\nThis will show metadata matches from Last.fm's database. The script uses\n`audioread`_ to decode music, so it should transparently use a media library\navailable on your system (GStreamer, FFmpeg, MAD, or Core Audio on Mac OS X).\n\n\nUsing in Your Code\n------------------\n\nThe script exhibits the usual way to use pylastfp, which is this::\n\n    \u003e\u003e\u003e import lastfp\n    \u003e\u003e\u003e xml = lastfp.match_file(apikey, path)\n    \u003e\u003e\u003e matches = lastfp.parse_metadata(xml)\n    \u003e\u003e\u003e print matches[0]['artist'], '-', matches[0]['title']\n    The National - Fake Emprire\n\nThis example uses the ``match_file`` convenience function, which uses\n`audioread`_ to decode audio data. The function imports the ``audioread`` module\nwhen called, so if you don't want to depend on that, just don't call this\nfunction.\n\nIf you have your own way of decoding audio, you can use the lower-level\ninterface::\n\n    \u003e\u003e\u003e xml = lastfp.match(apikey, pcmdata, samplerate, time_in_secs)\n\nOf course, you'll need a PCM stream for the audio you want to\nfingerprint. The pcmdata parameter must be an iterable of Python\n``str`` or ``buffer`` objects containing PCM data as arrays of C ``short``\n(16-bit integer) values.\n\nBoth functions (``match`` and ``match_file``) accept an additional optional\nparameter called ``metadata``. It should be a dict containing your current guess\nat the file's metadata. Last.fm might use this information to improve their\ndatabase. The dict should use these keys (all of which are optional):\n``\"artist\"``, ``\"album\"``, and ``\"track\"``.\n\nThe module internally performs thread-safe API limiting to 5 queries per\nsecond, in accordance with `Last.fm's API TOS`_.\n\n.. _Last.fm's API TOS: http://www.last.fm/api/tos\n\n\nTo-Do\n-----\n\nThe fingerprinting library allows for an optimization that skips decoding\na few milliseconds at the beginning of every file. (See\n``FingerprintExtractor::getToSkipMs()``, as demonstrated by the\n`example client`_.) Taking advantage of this will complicate the module's\ninterface a bit because the decoding source will need to know the amount of\ntime to skip.\n\n.. _example client:\n    http://github.com/lastfm/Fingerprinter/blob/master/lastfmfpclient/\n    src/main.cpp#L372\n\n\nVersion History\n---------------\n\n0.6\n  Use `audioread`_ instead of the included `pygst`_ and `pymad`_ decoders.\n  Fix compilation under clang 3.1.\n\n0.5\n  Handle empty responses from the API.\n  ``setup.py`` now searches the `Homebrew`_ user-local prefix.\n\n0.4\n  Fix cleanup bug in gstdec that was causing files to remain open.\n\n0.3\n  Fix typo in handling of HTTP errors.\n  Handle cases when HTTP status line is malformed.\n\n0.2\n  Fix a horrible memory leak.\n  Fail safely when file is too short.\n  Safely handle malformed XML returned from the API.\n  Handle and expose HTTP failures.\n\n0.1\n  Initial release.\n\n.. _Homebrew: http://mxcl.github.com/homebrew/\n.. _pymad: http://spacepants.org/src/pymad/\n.. _pygst: http://gstreamer.freedesktop.org/modules/gst-python.html\n\n\nCredits\n-------\n\nThis library is by `Adrian Sampson`_. It includes the fplib source code, which\nis by `Last.fm`_. fplib is licensed under the LGPLv3, so pylastfp uses the same\nlicense. pylastfp was written to be used with `beets`_, which you should\nprobably check out.\n\n.. _Adrian Sampson: mailto:adrian@radbox.org\n.. _Last.fm: http://last.fm/\n.. _beets: http://beets.radbox.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeetbox%2Fpylastfp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeetbox%2Fpylastfp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeetbox%2Fpylastfp/lists"}