Welcome to discogs_finder’s documentation!

Contents:

Usage: discogs-finder [OPTIONS] [QUERRY]...

FIND Every Release

Find the releases in your collection with an easy key value search. The script ‘discogs-finder’ accepts one QUERRY that is specified in form of a ‘key=value’ format. If the value contains whitespace, the argument must be contained in “quotation marks”.

Examples

$ discogs-finder --u titm6her name="Keith Jarrett"
$ discogs-finder --u titm6her name="ABC Impulse!"
$ discogs-finder --u titm6her id=3318191
$ discogs-finder --u --v titm6her title="An Evening"

Options

--u TEXT Your discogs user name
--v Verbose output dumping the whole json-file
--p Pretty output
--help Show this message and exit.

finder

Load your Discogs collection, querry releases and format them to strings

discogs_finder.finder.found_in_release(data, add=None, **querry)

Searches recursively in all leafes of the tree

Parameters:
  • data (dict) – the data tree
  • add (list) – address pre-fix, default None
  • querry (dict) – the key value pair to look for
Returns:

  • True if pair was found else False
  • If the pair was found, its address is returned, i.e., the sequence of nodes leading to the pair. List indices are returned as unicode(i). Note: If the pair was not found there is still a list returned but it contains an arbitrary address.
  • the matched value

Return type:

(bool, list, string)

Note

The value must only be contained in a leaf not equal the leafs value, i.e., “Kei” matches “Keith”.

Example

>>> with open('discogs_finder/tests/test.json', 'r') as f:
...    r = json.load(f)
>>> found_in_release(r, name="Keith") 
(True, [u'basic_information', u'artists', u'0', u'name'],
u'Keith Jarrett')
discogs_finder.finder.load_data(username)

Gets user collection (in all folders)

The collection is retrieved for the specified user from the Discogs API.

Parameters:username (string) – user name
Returns:user collection
Return type:(dict)

Example

>>> load_data('tim6her') 
[{u'instance_id': 188396596, u'date_added': ...
discogs_finder.finder.release_string(d_release)

Produces a string describing a release

Parameters:

d_release (dict) – dictonary containing the release data

Returns:

representing the release

Return type:

(string)

Raises:

(KeyError)

if the data does not contain the field “basic_information”.

>>> release_string({'id': 1}) 
Traceback (most recent call last):
...
KeyError: "Your release 1 doesn't contain the field 'basic_information'"

Example

>>> with open('discogs_finder/tests/test.json', 'r') as f:
...    r = json.load(f)
>>> release_string(r) 
u'Keith Jarrett: Shades (3318191)'

discogs_finder

FIND Every Release in your collection

build https://coveralls.io/repos/github/tim6her/discogs_finder/badge.svg?branch=master Documentation Status

This is a small commandline tool that fetches your discogs collection and performs a deep key value search.

$ discogs-finder --u tim6her name=Chick
Searching for {'name': 'Chick'}
1)  Herbie Hancock & Chick Corea: An Evening With Herbie Hancock & Chick Corea In Concert 1978 (530041)
    basic_information.artists.1.name = Chick Corea
2)  Chick Corea & Friedrich Gulda: The Meeting (2210545)
    basic_information.artists.0.name = Chick Corea
3)  Wolfgang Amadeus Mozart, Chick Corea, Friedrich Gulda, Concertgebouworkest, Nikolaus Harnoncourt: Double Concerto / Compositions (4764105)
    basic_information.artists.1.name = Chick Corea

It can also return the whole json entry for the matched releases using the --v option.

$ discogs-finder --u tim6her --v name=Pob
Searching for {'name': 'Pob'}
{
  "instance_id": 207732124,
  "date_added": "2017-01-14T05:32:34-08:00",
  "basic_information": {
    "formats": [
      {
        "qty": "1",
        "descriptions": [
          "LP",
          "Album", ...

For help on usage run discogs-finder --help or consult the Docs.

Indices and tables