Thomas Adamcik
20019edf2d
models: Fix review comments
2015-04-12 16:03:51 +02:00
Thomas Adamcik
777a663896
models: Take advantage of fact that our hash won't change
...
This might just be pointless micro-optimization as I have _not_ measured. But
it seemed silly to recursively hash everything in a model each time a hash is
required. As we know the data can not change.
2015-04-11 01:10:00 +02:00
Thomas Adamcik
79d1862510
models: Compare stream of items for models __eq__
...
Creating dictionaries for this is was just wasteful.
2015-04-11 01:07:18 +02:00
Thomas Adamcik
6327a67874
models: Make sure we really only add __weakref__ once
2015-04-11 00:47:53 +02:00
Thomas Adamcik
2cb2750b39
models: Simplify JSON decoder code
2015-04-08 23:23:55 +02:00
Thomas Adamcik
fb0e4dc7a1
models: Assign slots from fields
2015-04-08 23:20:59 +02:00
Thomas Adamcik
05244f7e60
models: Deprecate copy and add replace method
...
Changed as with the memoization copy was lying, so replace is a better name.
2015-04-08 01:41:50 +02:00
Thomas Adamcik
b7375323e9
models: Memoize identical instances automatically
...
This combined with the previous changes has brought the memory use for a 14k
track test-set down from about 75MB to 17MB or so. Note that this does however,
mean that copy is now lying to us as it does not such thing whenever it can
avoid it.
2015-04-08 01:14:56 +02:00
Thomas Adamcik
dd270ab87b
models: Stop using globals to get model names in JSON decoding.
2015-04-08 00:36:03 +02:00
Thomas Adamcik
86481b1d50
models: Shortcut case where copy didn't change anything
...
We no longer copy in this case and will just give you the same instance back.
2015-04-08 00:34:02 +02:00
Thomas Adamcik
0fee1b4b11
models: Switch to slots to reduce memory usage per instance
2015-04-08 00:30:53 +02:00
Thomas Adamcik
08fd99ffdb
models: Add Identifer type which interns values.
...
This gives some moderate memory saving since the values are used in multiple
places.
2015-04-08 00:11:23 +02:00
Thomas Adamcik
168c10448b
models: Use copy.copy for creating copies
2015-04-08 00:01:37 +02:00
Thomas Adamcik
9b442e1563
review: Address review comments
2015-04-06 23:27:46 +02:00
Thomas Adamcik
8604213276
models: Remove __dict__.copy() that did not do anything
2015-04-05 13:09:19 +02:00
Thomas Adamcik
f131ba4879
models: Update copy to only validate new values.
2015-04-05 13:09:19 +02:00
Thomas Adamcik
2d03cd7290
models: Make fields handle unsetting defaults in __dict__
2015-04-05 13:09:19 +02:00
Thomas Adamcik
7eda0160ca
models: Internal attrs are no longer needed
2015-04-05 13:09:19 +02:00
Thomas Adamcik
c375d772dd
models: Store field keys in models
2015-04-05 13:09:19 +02:00
Thomas Adamcik
c8693a0591
models: Simplify copy and serialize methods
...
We don't need to worry about internal vs external naming when doing things via
Fields.
2015-04-05 13:09:19 +02:00
Thomas Adamcik
73415ce60f
models: Make sure del on attributes does not work
2015-04-05 13:08:15 +02:00
Thomas Adamcik
4faf4de7aa
models: Convert all models to using fields.
2015-04-05 13:08:15 +02:00
Thomas Adamcik
07912e1091
models: Add fields for supporting validation of models
...
Feature makes use of python descriptors to hook in type checking and other
validation when fields get set.
2015-04-05 13:08:15 +02:00
Stein Magnus Jodal
c4940cbea2
autopep8: Add space after class signature/docstring
2015-04-03 00:05:26 +02:00
Stein Magnus Jodal
0f21e7425e
Merge pull request #1039 from adamcik/bug/923/duration-as-int-or-none
...
core: Correctly handle missing duration in seek.
2015-03-15 21:26:16 +01:00
Thomas Adamcik
6adeea6009
core: Correctly handle missing duration in seek.
...
Seeks will now fail when the duration is None, this is an approximation to if
the track is seekable or not. This check is need as otherwise seeking a radio
stream will trigger the next track.
If the track truly isn't seekable despite having a duration we should still
fail as GStreamer will reject the seek.
2015-03-15 11:29:07 +01:00
Stein Magnus Jodal
3a61445519
models: Change Track.last_modified from seconds to ms
2015-03-14 00:06:23 +01:00
Stein Magnus Jodal
638740541b
Merge pull request #981 from adamcik/feature/core-get-images
...
Add library.get_images()
2015-02-13 00:33:29 +01:00
Lasse Bigum
34ada2784a
flake8: fix PEP8 warnings about lambda
...
Fix the 'lambda to def' warnings
2015-02-12 22:10:36 +01:00
Thomas Adamcik
05b66ba4a3
models: Add basic image model
2015-02-12 22:02:59 +01:00
Stein Magnus Jodal
b46844fbe2
docs: Fix copy-paste error
2015-01-21 23:03:35 +01:00
Stein Magnus Jodal
496142c201
py3: Use absolute imports by default
2014-12-07 20:17:10 +01:00
Stein Magnus Jodal
abed15b9e4
models: Make all fields default to None or empty collection
2014-09-22 22:25:42 +02:00
Stein Magnus Jodal
bdd1fb983b
models: Fix equality for fields set to the default
...
Fixes #837
2014-09-22 22:01:50 +02:00
Stein Magnus Jodal
305a76486d
models: Hide empty lists from repr()
2014-09-22 21:42:57 +02:00
Stein Magnus Jodal
38d3c6ccf9
models: Make Playlist.last_modified milliseconds since Unix epoch
2014-01-28 23:57:02 +01:00
Thomas Adamcik
81b920a9e4
model: Update to handle None in sets.
...
Also adds some missing tests for composers and performers.
2014-01-15 22:20:36 +01:00
Thomas Adamcik
b0b5d4972f
models: Make .copy(foo=None) null out field.
2014-01-15 22:20:36 +01:00
Stein Magnus Jodal
7897fe7bac
Fix typos
2014-01-10 00:04:39 +01:00
Stein Magnus Jodal
9da5ccbb79
models: Add type specific constructors to Ref
2014-01-09 08:50:31 +01:00
Stein Magnus Jodal
af3b0e40fd
models: Add Ref.type constants
2014-01-03 22:19:54 +01:00
Stein Magnus Jodal
d3dcceefc5
models: Add description of Ref model
2013-12-29 21:08:46 +01:00
Stein Magnus Jodal
e87d5729e3
models: Add lightweight Ref model with URI, name, and type
2013-12-29 19:31:14 +01:00
Lasse Bigum
f5e94d8f7c
Address review comments
2013-11-13 00:40:47 +01:00
Lasse Bigum
df1820f0a7
Add genre, composer, and performer tags and use them
2013-11-02 02:29:37 +01:00
Stein Magnus Jodal
e830f31480
Fix too broad truthness test ( fix #501 )
...
This caused TlTracks with tlid=0 to be sent to HTTP clients without the tlid
field.
2013-09-16 21:58:23 +02:00
Thomas Adamcik
b4411ec877
scanner: Update based on review comments.
2013-05-20 15:28:41 +02:00
Thomas Adamcik
b3b41240a1
core: Add last_modified to track model
2013-05-19 23:47:53 +02:00
Stein Magnus Jodal
de84fdfef4
Remove hacks required by #302 to run on older Python 2.6.x
2013-04-29 19:52:29 +02:00
Stein Magnus Jodal
fc76318f20
models: Comment Album.images not preserving order
2013-03-24 00:03:42 +01:00