flow chart
This commit is contained in:
parent
53f1254231
commit
3a7f3aee6e
27
README.md
27
README.md
@ -306,15 +306,28 @@ flowchart TD
|
|||||||
exist("""
|
exist("""
|
||||||
<b>Check if music_object already exists.</b>
|
<b>Check if music_object already exists.</b>
|
||||||
<hr>
|
<hr>
|
||||||
Gets all indexing values with <code>music_object.indices</code>.
|
Gets all indexing values with <code>music_object.indexing_values</code>.
|
||||||
If any returned value exists in <code>Collection.object_map</code>,
|
If any returned value exists in <code>Collection._attribute_to_object_map</code>,
|
||||||
the music_object exists
|
the music_object exists
|
||||||
""")
|
""")
|
||||||
|
|
||||||
subgraph merge["Merge the object with the already existing one."]
|
subgraph merge["Merging"]
|
||||||
|
|
||||||
|
_merge("""merges the passed in object in the already
|
||||||
|
existing whith <code>existing.merge(new)</code>""")
|
||||||
|
|
||||||
|
_map("""In case a new source or something simmilar
|
||||||
|
has been addet, it maps the existing object again.
|
||||||
|
""")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
_merge --> _map --> return
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph add["Adding the object to the collection."]
|
subgraph add["Adding"]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
exist-->|"if it doesn't exist"|add
|
exist-->|"if it doesn't exist"|add
|
||||||
@ -329,9 +342,9 @@ the music_object exists
|
|||||||
|
|
||||||
#### Song
|
#### Song
|
||||||
|
|
||||||
So as you can see, the probaply most important Class is the `music_kraken.Song` class. It is used to save the song in *(duh)*.
|
So as you can see, the probably most important Class is the `music_kraken.Song` class. It is used to save the song in *(duh)*.
|
||||||
|
|
||||||
It has handfull attributes, where half of em are self explanatory, like `title` or `genre`. The ones like `isrc` are only relevant to you, if you know what it is, so I won't elaborate on it.
|
It has handful attributes, where half of em are self-explanatory, like `title` or `genre`. The ones like `isrc` are only relevant to you, if you know what it is, so I won't elaborate on it.
|
||||||
|
|
||||||
Interesting is the `date`. It uses a custom class. More on that [here](#music_krakenid3timestamp).
|
Interesting is the `date`. It uses a custom class. More on that [here](#music_krakenid3timestamp).
|
||||||
|
|
||||||
@ -341,7 +354,7 @@ For multiple Reasons I don't use the default `datetime.datetime` class.
|
|||||||
|
|
||||||
The most important reason is, that you need to pass in at least year, month and day. For every other values there are default values, that are indistinguishable from values that are directly passed in. But I need optional values. The ID3 standart allows default values. Additionally `datetime.datetime` is immutable, thus I can't inherint all the methods. Sorry.
|
The most important reason is, that you need to pass in at least year, month and day. For every other values there are default values, that are indistinguishable from values that are directly passed in. But I need optional values. The ID3 standart allows default values. Additionally `datetime.datetime` is immutable, thus I can't inherint all the methods. Sorry.
|
||||||
|
|
||||||
Anyways you can create those custom objects easily.
|
Anyway you can create those custom objects easily.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from music_kraken import ID3Timestamp
|
from music_kraken import ID3Timestamp
|
||||||
|
@ -59,7 +59,10 @@ class Collection:
|
|||||||
if value in self._attribute_to_object_map[name]:
|
if value in self._attribute_to_object_map[name]:
|
||||||
# if the object does already exist
|
# if the object does already exist
|
||||||
# thus merging and don't add it afterwards
|
# thus merging and don't add it afterwards
|
||||||
self._attribute_to_object_map[name][value].merge(element)
|
existing_object = self._attribute_to_object_map[name][value]
|
||||||
|
existing_object.merge(element)
|
||||||
|
# in case any relevant data has been added (e.g. it remaps the old object)
|
||||||
|
self.map_element(existing_object)
|
||||||
return
|
return
|
||||||
|
|
||||||
self._data.append(element)
|
self._data.append(element)
|
||||||
|
Loading…
Reference in New Issue
Block a user