about summary refs log tree commit homepage
path: root/lib/dtas/track.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-05 02:32:19 +0000
committerEric Wong <e@80x24.org>2015-12-05 02:33:29 +0000
commit7b065706d37df9e54c8b3299ce696545c6159fa4 (patch)
treeb3079286e218fa40d9e0c65ee6de89d110b93d30 /lib/dtas/track.rb
parent2d444cadc7c5dc42d89c02a9d999938c40bdcb9d (diff)
downloaddtas-7b065706d37df9e54c8b3299ce696545c6159fa4.tar.gz
This is easier for users to read and type; and _might_ help with
race conditions due to fast object recycling from GC.  We'll also be
implementing playist versioning on top of this in the next commits
for MPD protocol compatibility.

Unfortunately this adds an additional 40 bytes of per-track overhead
(on 64-bit systems, its only 20 bytes on 32-bit).  However, we may
be able to save memory in the future by supporting dtas-mlib node
IDs if we integrate dtas-player with DTAS::Mlib.

While we're at it, include a minor speedup for
DTAS::Tracklist#remove_track by using Array#delete_at instead of
relying on Array#compact!  after assignment

This should improve "dtas-tl cat" output readability dramatically.

The state file (~/.dtas/player_state.yml) remains compatible
between dtas-player before and after this change.
Diffstat (limited to 'lib/dtas/track.rb')
-rw-r--r--lib/dtas/track.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/dtas/track.rb b/lib/dtas/track.rb
new file mode 100644
index 0000000..215ee52
--- /dev/null
+++ b/lib/dtas/track.rb
@@ -0,0 +1,13 @@
+# Copyright (C) 2015 all contributors <dtas-all@nongnu.org>
+# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+require_relative '../dtas'
+
+class DTAS::Track
+  attr_reader :track_id
+  attr_reader :to_path
+
+  def initialize(track_id, path)
+    @track_id = track_id
+    @to_path = path
+  end
+end