Skip to content

Instantly share code, notes, and snippets.

@bczhc
Created June 26, 2022 02:33
Show Gist options
  • Select an option

  • Save bczhc/ad58a291895f701839098e4b403a521a to your computer and use it in GitHub Desktop.

Select an option

Save bczhc/ad58a291895f701839098e4b403a521a to your computer and use it in GitHub Desktop.
QQ音乐新版ekey从数据库中获取脚本
#!/usr/bin/env ruby
require 'sqlite3'
argv = ARGV
if argv.empty?
puts "Usage: #{File.basename $0} <database> <path-key>"
return
end
database = argv[0]
path_key = argv[1]
# @type [String]
record = nil
count = 0
database = SQLite3::Database.new database
database.execute('SELECT ekey FROM audio_file_ekey_table WHERE file_path IS ?', [path_key]) do |row|
record = row
count += 1
end
throw "No record" if record == nil
throw "Duplicated records" unless count == 1
puts record
@bczhc

bczhc commented Jun 26, 2022

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment