]> git.mdlowis.com Git - proto/atv.git/commitdiff
sort the results and save teh state to web root instead of /tmp
authorMike Lowis <mike.lowis@gentex.com>
Thu, 6 Feb 2025 17:41:25 +0000 (12:41 -0500)
committerMike Lowis <mike.lowis@gentex.com>
Thu, 6 Feb 2025 17:41:25 +0000 (12:41 -0500)
atv/lib/atv/channel.rb
atv/lib/atv/player.rb

index 68cabd05a33767d8440eb8793c44c5fc78d6f2a3..9aec110bc136f11b1237656af22162fcca03c7bf 100644 (file)
@@ -103,7 +103,7 @@ module ATV
           data["type"] = "dir"
         end
         data
-      end
+      end.sort {|a,b| a["name"] <=> b["name"] }
       { "items" => items }
     end
 
index 97389743a94d95d8fd5fb553894d165949a4d105..f67209410962483ac6d7763d247874dfb1c5fe03 100644 (file)
@@ -5,8 +5,8 @@ module ATV
       @channel = 0
       @channels = channels
       @playing = true
-      if File.exist? "/tmp/atv.json"
-        data = JSON.parse(File.read("/tmp/atv.json"))
+      if File.exist? "#{ATV_ROOT}/atv.json"
+        data = JSON.parse(File.read("#{ATV_ROOT}/atv.json"))
         data.each_with_index {|e, i| channels[i].import_state e }
       end
     end
@@ -18,7 +18,7 @@ module ATV
         updated ||= c.update(@playing)
         export_data << c.export_state
       end
-      File.open("/tmp/atv.json", "wb") do |f|
+      File.open("#{ATV_ROOT}/atv.json", "wb") do |f|
         f.write JSON.dump(export_data)
       end
       updated