aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Eliasson <devel@antoneliasson.se>2016-05-09 13:27:20 (GMT)
committerAnton Eliasson <devel@antoneliasson.se>2016-05-09 13:27:20 (GMT)
commit166b926beae116fbe62f6a1500c5b91984d31200 (patch)
treed930f827e03f3ff6ba9998619e90a602393300ca
parent13a5419bee420951a763c02b8d95b70aff7e003d (diff)
downloadmediacacherd-master.zip
mediacacherd-master.tar.gz
mediacacherd-master.tar.xz
Add current uncommitted stuff for archival purposesHEADmaster
-rw-r--r--TODO.org15
-rw-r--r--client/src/main/scala/se/antoneliasson/mediacacherd/LibraryTraverser.scala14
-rw-r--r--client/src/test/scala/se/antoneliasson/mediacacherd/LibraryTraverserSpec.scala12
3 files changed, 41 insertions, 0 deletions
diff --git a/TODO.org b/TODO.org
new file mode 100644
index 0000000..707e3d5
--- /dev/null
+++ b/TODO.org
@@ -0,0 +1,15 @@
+* TODO Hantera undantag som kan hända när filen öppnas och när taggar läses:
+http://www.jthink.net/jaudiotagger/javadoc/org/jaudiotagger/tag/Tag.html#getFirst%28org.jaudiotagger.tag.FieldKey%29
+
+* TODO Kolla så att taggen finns (KeyNotFoundException) och att den inte är tom
+ (!empty)
+
+* TODO Skapa kataloger: Separera Path i katalogsökväg och filnamn.
+ Files.createDirectories(katalogsökväg)
+
+* TODO Ta fram target-katalog. Sökväg till varje fil fås av target.resolve(filsökväg)
+
+* TODO Läsa och skriva binära filer i Java >=7:
+ http://www.javapractices.com/topic/TopicAction.do?Id=245
+
+* TODO Lägg till trasiga saker i biblioteket (korrupta filer, inga rättigheter)
diff --git a/client/src/main/scala/se/antoneliasson/mediacacherd/LibraryTraverser.scala b/client/src/main/scala/se/antoneliasson/mediacacherd/LibraryTraverser.scala
new file mode 100644
index 0000000..f7fc831
--- /dev/null
+++ b/client/src/main/scala/se/antoneliasson/mediacacherd/LibraryTraverser.scala
@@ -0,0 +1,14 @@
+package se.antoneliasson.mediacacherd
+
+import java.nio.file.attribute.BasicFileAttributes
+import java.nio.file.{SimpleFileVisitor, Path}
+
+import scala.collection.mutable
+
+class LibraryTraverser(val libraryRoot: Path) extends SimpleFileVisitor[Path] {
+ var paths = new mutable.MutableList[Path]
+
+ override def visitFile(file: Path, attr: BasicFileAttributes): Unit = {
+ paths += file
+ }
+}
diff --git a/client/src/test/scala/se/antoneliasson/mediacacherd/LibraryTraverserSpec.scala b/client/src/test/scala/se/antoneliasson/mediacacherd/LibraryTraverserSpec.scala
new file mode 100644
index 0000000..469ebee
--- /dev/null
+++ b/client/src/test/scala/se/antoneliasson/mediacacherd/LibraryTraverserSpec.scala
@@ -0,0 +1,12 @@
+package se.antoneliasson.mediacacherd
+
+import java.nio.file.Paths
+
+import org.scalatest.{FlatSpec, Matchers}
+
+class LibraryTraverserSpec extends FlatSpec with Matchers {
+ "A LibraryTraverser" can "create MediaLoaders for each file in a media library" in {
+ val libraryRoot = Paths.get("src/test/resources/sourcedir")
+ val lt = new LibraryTraverser(libraryRoot)
+ }
+}