dubbletrack_remote 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 737276cc038e3106828b180bf4b8e3edd7543661bdd62c88db8c9494b73b5e4e
4
+ data.tar.gz: b3289ba0b88986323b840eb52b3eb55e09fd257700931fbe01428dce11283051
5
+ SHA512:
6
+ metadata.gz: 6f31a1b3d57066aa1d14d989a56520c9cdc216e5e353f29f6dd43a0b76a0e1d0dc768e661e16fc6029256efb86ecfb594288d3f9c186f7b5e507763bbb83fced
7
+ data.tar.gz: 2e44c51067b700b268ab1e4167fd0814171a160fee5b10700e384e58419c51588c8279ade0fd771af2965f584fee241d353aeca135d93b944c8115c59e8b66bf
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Generate New Release
3
+
4
+ on:
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ release:
9
+ name: Release
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v2
14
+ with:
15
+ fetch-depth: 0
16
+ persist-credentials: false
17
+ - name: Setup Node.js
18
+ uses: actions/setup-node@v2
19
+ with:
20
+ node-version: 14
21
+ - name: Install Dependencies
22
+ run: yarn install --frozen-lockfile
23
+ - name: Release
24
+ env:
25
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
27
+ run: node_modules/.bin/semantic-release
@@ -0,0 +1,46 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: ['2.6', '2.7', '3.0']
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - name: Set up Ruby
25
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
26
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ cache-version: 1
32
+ - name: Setup db
33
+ run: bundle exec rake setup
34
+ - name: Run tests
35
+ run: bundle exec rake spec
36
+ publish:
37
+ name: Release
38
+ runs-on: ubuntu-latest
39
+ if: github.ref == 'refs/heads/main'
40
+ needs: [test]
41
+ steps:
42
+ - name: Dispatch Release
43
+ uses: benc-uk/workflow-dispatch@v1
44
+ with:
45
+ workflow: Generate New Release
46
+ token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,48 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalization:
26
+ /.bundle/
27
+ /vendor/bundle
28
+ /lib/bundler/man/
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+
33
+ Gemfile.lock
34
+
35
+ .ruby-version
36
+ .ruby-gemset
37
+
38
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39
+ .rvmrc
40
+
41
+ .DS_Store
42
+ .byebug_history
43
+ db/*.sqlite3
44
+ *.rsa*
45
+
46
+ playlists/
47
+ settings.yml
48
+ support/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,54 @@
1
+
2
+ require:
3
+ - standard
4
+ - anycable/rails/compatibility/rubocop
5
+ - test_prof/rubocop
6
+
7
+ # inherit_from: .rubocop_todo.yml
8
+ inherit_gem:
9
+ standard: config/base.yml
10
+
11
+ inherit_from: .rubocop_todo.yml
12
+
13
+ AllCops:
14
+ TargetRubyVersion: 3.1
15
+ Exclude:
16
+ - 'db/**/*'
17
+ - 'config/**/*'
18
+ - 'script/**/*'
19
+ - 'bin/{rails,rake}'
20
+ - 'vendor/**/*'
21
+
22
+ RSpec/AggregateExamples:
23
+ Enabled: true
24
+ Include:
25
+ - 'spec/**/*.rb'
26
+
27
+ Layout/ArgumentAlignment:
28
+ Enabled: false
29
+ EnforcedStyle: with_first_argument
30
+
31
+ Layout/SpaceAroundOperators:
32
+ Enabled: false
33
+
34
+ Layout/ExtraSpacing:
35
+ Enabled: true
36
+ AllowForAlignment: true
37
+ AllowBeforeTrailingComments: true
38
+ ForceEqualSignAlignment: true
39
+
40
+ Layout/ArrayAlignment:
41
+ Enabled: true
42
+ EnforcedStyle: with_first_element
43
+
44
+ Layout/SpaceInsideHashLiteralBraces:
45
+ Enabled: true
46
+ EnforcedStyle: space
47
+
48
+ Layout/HashAlignment:
49
+ Enabled: true
50
+ EnforcedColonStyle: table
51
+
52
+ Layout/BeginEndAlignment:
53
+ Enabled: true
54
+ EnforcedStyleAlignWith: begin
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.2
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Dubbletrack Remote
2
+ This gem reads in playlists from automation systems and sends them to dubbletrack.
3
+
4
+ ## Installation
5
+ 1. settings-example.yml should be copied to settings.yml and modified with your settings
6
+ 2. Use pm2 to run the dubbletrack_remote gem
7
+
8
+ #### Enco
9
+ Reads directly from the enco .DBF files and cross references items to the CUTS.DBF data and sends the full dataset to dubbletrack including:
10
+
11
+ title, artist, album, label, date, time, duration, automation_id, automation_group, genre, guid, source
12
+
13
+ ####
14
+ Run this with PM2 by installing the gem, and then running with `pm2 start --interpreter=bash dubbletrack_remote`
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ # imports everything (gems and local files) specified in environment.rb
2
+ require_relative "lib/dubbletrack_remote"
3
+ # gives us an arsenal of rake tasks for managing our database
4
+ require "sinatra/activerecord/rake"
5
+ require "rspec/core/rake_task"
6
+
7
+ # describes the task
8
+ desc "starts a console"
9
+ # establishes the name of the rake option: console
10
+ task :console do
11
+ # turns on logging of SQL queries while in the task
12
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
13
+ # starts a Ruby REPL session
14
+ Pry.start
15
+ end
16
+
17
+ desc "setup"
18
+ task :setup do
19
+ ENV["DUBBLETRACK_REMOTE_ENV"] = "test"
20
+ `RAILS_ENV=test bundle exec rake db:schema:load`
21
+ end
22
+
23
+ desc "run tests"
24
+ task :spec do
25
+ ENV["DUBBLETRACK_REMOTE_ENV"] = "test"
26
+ RSpec::Core::RakeTask.new(:spec)
27
+ end
28
+
29
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dubbletrack_remote"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ #require "irb"
14
+ #IRB.start(__FILE__)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require_relative '../lib/dubbletrack_remote'
5
+
6
+ DubbletrackRemote::CLI.start(ARGV)
@@ -0,0 +1,15 @@
1
+ default: &default
2
+ adapter: sqlite3
3
+ encoding: utf8
4
+
5
+ development:
6
+ <<: *default
7
+ database: db/dubbletrack-remote.sqlite3
8
+
9
+
10
+ # Warning: The database defined as "test" will be erased and
11
+ # re-generated from your development database when you run "rake".
12
+ # Do not set this db to the same as development or production.
13
+ test:
14
+ <<: *default
15
+ database: db/dubbletrack-remote-test.sqlite3
@@ -0,0 +1,8 @@
1
+ api_url: https://data.dubbletrack.com/api/v1/stations/[station_id]/automation
2
+ api_key:
3
+ api_secret:
4
+ automation:
5
+ type: enco
6
+ playlist_path: /mnt/ENCO/DAD/Asplay/ENCO1%m%d%y.DBF
7
+ cuts_path: /mnt/ENCO/DAD/Files/CUTS.DBF
8
+ delay_seconds: 40
@@ -0,0 +1,19 @@
1
+ class Schema < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :items, force: true do |t|
4
+ t.datetime :played_at, index: true, unique: true
5
+ t.string :item_type
6
+ t.string :title
7
+ t.string :artist_name
8
+ t.string :label_name
9
+ t.string :release_name
10
+ t.boolean :success
11
+ t.string :remote_id
12
+ t.datetime :last_attempt_at
13
+ t.string :last_error_text
14
+ t.integer :last_error_code
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ class AddItemColumns < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :items, :duration, :integer
4
+ add_column :items, :automation_id, :string, index: true
5
+ add_column :items, :automation_group, :string, index: false
6
+ add_column :items, :genre, :string, index: false
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class AddDebugItemColumns < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :items, :intended_played_at, :datetime
4
+ add_column :items, :source, :string
5
+ add_column :items, :guid, :string
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddAutomationSystemColumn < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :items, :automation_system, :string
4
+ end
5
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,40 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 4) do
14
+
15
+ create_table "items", force: :cascade do |t|
16
+ t.datetime "played_at"
17
+ t.string "item_type"
18
+ t.string "title"
19
+ t.string "artist_name"
20
+ t.string "label_name"
21
+ t.string "release_name"
22
+ t.boolean "success"
23
+ t.string "remote_id"
24
+ t.datetime "last_attempt_at"
25
+ t.string "last_error_text"
26
+ t.integer "last_error_code"
27
+ t.datetime "created_at", precision: 6, null: false
28
+ t.datetime "updated_at", precision: 6, null: false
29
+ t.integer "duration"
30
+ t.string "automation_id"
31
+ t.string "automation_group"
32
+ t.string "genre"
33
+ t.datetime "intended_played_at"
34
+ t.string "source"
35
+ t.string "guid"
36
+ t.string "automation_system"
37
+ t.index ["played_at"], name: "index_items_on_played_at"
38
+ end
39
+
40
+ end
data/db/seed.rb ADDED
File without changes
Binary file
@@ -0,0 +1,64 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "dubbletrack_remote/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "dubbletrack_remote"
7
+ spec.version = DubbletrackRemote::VERSION
8
+ spec.authors = ["Jeff Keen"]
9
+ spec.email = ["jeff@dubbletrack.com"]
10
+
11
+ spec.summary = "Posts data from automation systems to dubbletrack.com. Requires dubbletrack account"
12
+ spec.description = ""
13
+ spec.homepage = "http://github.com/dubbletrack/remote"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ # spec.metadata["allowed_push_host"] = 'https://rubygems.org'
20
+
21
+ # spec.metadata["homepage_uri"] = spec.homepage
22
+ # spec.metadata["source_code_uri"] = "http://github.com/jkeen/dubbletrack_remote"
23
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
+ else
25
+ raise "RubyGems 2.0 or newer is required to protect against " \
26
+ "public gem pushes."
27
+ end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "bin"
35
+ spec.executables << "dubbletrack_remote"
36
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "minitest", "~> 5.11.3"
40
+ spec.add_development_dependency "standard", "~> 1.9.0"
41
+ spec.add_dependency "activerecord", "~> 6.0.3"
42
+ spec.add_dependency "activesupport", "~> 6.0.3.7"
43
+ spec.add_dependency "bundler", "~> 2.0"
44
+ spec.add_dependency "byebug", "~> 11.1.3"
45
+ spec.add_dependency "config", "~>2.2.1"
46
+ spec.add_dependency "csv", "~> 3.1.7"
47
+ spec.add_dependency "dotenv", "~> 2.7.6"
48
+ spec.add_dependency "dbf", "~> 4.1.3"
49
+ spec.add_dependency "faraday", "~> 1.0"
50
+ spec.add_dependency "json", "~> 2.3.1"
51
+ spec.add_dependency "listen", "~> 3.0"
52
+ spec.add_dependency "pry", "~> 0.13"
53
+ spec.add_dependency "rake", "~> 10.0"
54
+ spec.add_dependency "rchardet", "~> 1.8.0"
55
+ spec.add_dependency "require_all", "~> 3.0"
56
+ spec.add_dependency "rspec", "~> 3.9.0"
57
+ spec.add_dependency "sinatra-activerecord", "~> 2.0.18"
58
+ spec.add_dependency "sqlite3", "~> 1.4.2"
59
+ spec.add_dependency "thor", "~> 1.0.1"
60
+ spec.add_dependency "timecop", "~> 0.9.1"
61
+ spec.add_dependency "tzinfo", "~> 1.2.9"
62
+ spec.add_dependency "webmock", "~> 3.9.1"
63
+ spec.add_dependency "yaml", "~> 0.1.0"
64
+ end
@@ -0,0 +1,34 @@
1
+ {define_begin}
2
+ 1 :ASPLAY->CUT
3
+ 2 :ASPLAY->TITLE
4
+ 3 :ASPLAY->SCHDUR
5
+ 4 :ASPLAY->SCHSTART
6
+ 5 :ASPLAY->ACTDUR
7
+ 6 :ASPLAY->ACTSTART
8
+ 7 :ASPLAY->ACTSTOP
9
+ 8 :CUTS->PRODUCER
10
+ 9 :ASPLAY->PLAYER
11
+ 10 :ASPLAY->DATE
12
+ 11 :CUTS->ALBUM
13
+ 12 :CUTS->ARTIST
14
+ 13 :CUTS->GROUP
15
+ {define_end}
16
+
17
+ {relation_begin}
18
+ ASPLAY->CUT N->1 CUTS->CUT
19
+ {relation_end}
20
+
21
+ {pagesize} 400
22
+
23
+ {group_begin}
24
+ ASPLAY->CUT
25
+ {group_end}
26
+
27
+ {page_header_begin}
28
+ TITLE ARTIST ALBUM LABEL TIME DATE
29
+ {header_end}
30
+ {header_begin}
31
+ {if} d9 == " 4"
32
+ [d2 ] [d12 ] [d11 ] [d8 ] [d6 ] [d10 ]
33
+ {endif}
34
+ {header_end}
@@ -0,0 +1,15 @@
1
+ `{define_begin}` to `{define_end}` defines variables to be referenced later.
2
+
3
+ `{relation_begin}` to `{relation_end}` is essential, and I think it sets up where this data is being pulled from
4
+
5
+ `{pagesize}` dictates how many items are printed before that `{page_header_begin}` to `{header_end}` is printed again. This caused the old "csv" report to be broken up with sections of non-csv data.
6
+
7
+ the `{header_begin}` to `{header_end}` section at the bottom is what gets printed for each entry.
8
+
9
+ The `{if} d9 == "4 "` statement is checking that only tracks that come from deck #4 get logged.
10
+
11
+ Each column of the file (track, artist, etc) is dictated by the bracketed sections, where the number of spaces after the referenced variable equates to the maximum width to allow for that value before it gets chopped (so dumb, I know). `[d2 ]`
12
+
13
+ The format we want to output is a tab separated file, so we when there are commas in a track it doesn't cause problems. We also want to make the field widths as large as possible to prevent truncation, and the page size huge to prevent that silly page header from printing out periodically.
14
+
15
+ Puts this new Asplay.rpg file in K:\Dad\Files\Asplay.RPG