Page MenuHomePhabricator

No OneTemporary

diff --git a/AutoCoverTool/script/get_song_url.py b/AutoCoverTool/script/get_song_url.py
index 6e5ba6d..8775278 100644
--- a/AutoCoverTool/script/get_song_url.py
+++ b/AutoCoverTool/script/get_song_url.py
@@ -1,314 +1,347 @@
"""
获取歌曲的地址
"""
from script.common import *
from copy import deepcopy
from online.common import update_db
def get_url_by_song_id(song_id):
sql = "select task_url,starmaker_songid from silence where starmaker_songid = {} order by task_id limit 1".format(
song_id)
ban = deepcopy(banned_user_map)
ban["db"] = "starmaker_musicbook"
data = get_data_by_mysql(sql, ban)
if len(data) > 0:
return data[0][0]
return None
def process():
arr = [
"611752105016642206",
"611752105016665828",
"611752105020332340",
"611752105020332347",
"611752105020390931",
"611752105020417679",
"611752105021442334",
"611752105021459528",
"611752105021810110",
"611752105021916843",
"611752105022312180",
"611752105022614734",
"611752105022615541",
"611752105022615665",
"611752105022616931",
"611752105022647066",
"611752105022647087",
"611752105022652047",
"611752105022700847",
"611752105022728649",
"611752105022728653",
"611752105022729255",
"611752105022733605",
"611752105022736029",
"611752105022740011",
"611752105022742166",
"611752105022743986",
"611752105022746848",
"611752105022748944",
"611752105022749272",
"611752105022749768",
"611752105022751902",
"611752105022752248",
"611752105022754267",
"611752105022755405",
"611752105022757577",
"611752105022758309",
"611752105022758395",
"611752105022761145",
"611752105022761151",
"611752105022764435",
"611752105022764965",
"611752105022766106",
"611752105022766675",
"611752105022774258",
"611752105022776257",
"611752105022776285",
"611752105022776577",
"611752105022776846",
"611752105022777151",
"611752105022777306",
"611752105022778977",
"611752105022779055",
"611752105022779169",
"611752105022779962",
"611752105022780648",
"611752105022784727",
"611752105022785048",
"611752105022785179",
"611752105022785551",
"611752105022811718",
"611752105022814368",
"611752105022815931",
"611752105022819519",
"611752105022824948",
"611752105022828998",
"611752105022833822",
"611752105022835250",
"611752105022838357",
"611752105022838544",
"611752105022838589",
"611752105022838666",
"611752105022839015",
"611752105022839300",
"611752105022839468",
"611752105022839559",
"611752105022892354",
"611752105022911042",
"611752105023134539",
"611752105023142842",
"611752105023588294",
"611752105024204862",
"611752105024546859",
"611752105024598735",
"611752105024938931",
"611752105025327479",
"611752105025565027",
"611752105025720331",
"611752105025741447",
"611752105025817802",
"611752105026281560",
"611752105026388268",
"611752105026421148",
"611752105026536897",
"611752105026536911",
"611752105026580839",
"611752105026648945",
"611752105026663363",
"611752105026736866",
"611752105027067863",
"611752105027112518",
"611752105027186556",
"611752105027189208",
"611752105027189301",
"611752105027326104",
"611752105027460089",
"611752105027484913",
"611752105027588072",
"611752105027611383",
"611752105027690075",
"611752105028470803",
"611752105028507652",
"611752105028528335",
"611752105028815367",
"611752105028820629",
"611752105028820633",
"611752105028878340",
"611752105028906600",
"611752105028944645",
"611752105028958744",
"611752105029006303",
"611752105029006319",
"611752105029059923",
"611752105029078388",
"611752105029090034",
"611752105029209546",
"611752105029243449",
"611752105029272970",
"611752105029291291",
"611752105029291294",
"611752105029291295",
"611752105029291297",
"611752105029291298",
"611752105029291304",
"611752105029395411",
"611752105029432787",
"611752105029570149",
"611752105029570153",
"611752105029570157",
"611752105029953987",
"611752105029954853",
"611752105029955024",
"611752105029955258",
"611752105029956379",
"611752105029956615",
"611752105029990162",
"611752105029990590",
"611752105029991249",
"611752105030103635",
"611752105030119229",
"611752105030124600",
"611752105030485000",
"611752105030485417",
"611752105030485428",
"611752105030485533",
"611752105030485561",
"611752105030485562",
"611752105030485565",
"611752105030485566",
"611752105030485569",
"611752105030485570",
"611752105030485572",
"611752105030485591",
"611752105030485592",
"611752105030485594",
"611752105030485595",
"611752105030485597",
"611752105030485598",
"611752105030485601",
"611752105030485602",
"611752105030485607",
"611752105030485608",
"611752105030485610",
"611752105030485612",
"611752105030485613",
"611752105030485616",
"611752105030485618",
"611752105030485620",
"611752105030485621",
"611752105030485626",
"611752105030485627",
"611752105030485631",
"611752105030485634",
"611752105030485637",
"611752105030485639",
"611752105030485642",
"611752105030485646",
"611752105030485650",
"611752105030485653",
"611752105030485655",
"611752105030485656",
"611752105030485662",
"611752105030485663",
"611752105030485666",
"611752105030485667",
"611752105030485669",
"611752105030485671",
"611752105030485672",
"611752105030485673",
"611752105030485676",
"611752105030485677",
"611752105030485679",
"611752105030485681",
"611752105030485682",
"611752105030485685",
"611752105030485687",
"611752105030485688",
"611752105030485691",
"611752105030485692",
"611752105030485693",
"611752105030485696",
"611752105030485697",
"611752105030485700",
"611752105030485702",
"611752105030485703",
"611752105030485707",
"611752105030485710",
"611752105030485711",
"611752105030485715",
"611752105030485716",
"611752105030485717",
"611752105030485721",
"611752105030485722",
"611752105030485724",
"611752105030485726",
"611752105030485727",
"611752105030485729",
"611752105030485731",
"611752105030485733",
"611752105030485734",
"611752105030485736",
"611752105030485737",
"611752105030485738",
"611752105030485739",
"611752105030485741",
"611752105030485742",
"611752105030485744",
"611752105030485745",
"611752105030485748",
"611752105030485749",
"611752105030485750",
"611752105030485755",
"611752105030485758",
"611752105030485759",
"611752105030485761",
"611752105030485763",
"611752105030485766",
"611752105030485768",
"611752105030485769",
"611752105030485772",
"611752105030485778",
"611752105030485779",
"611752105030485787",
"611752105030485790",
"611752105030485791",
"611752105030485794",
"611752105030485797",
"611752105030485799",
"611752105030488510",
"611752105030488594",
"611752105030488665",
"611752105030488713",
"611752105030488727",
"611752105030488744",
"611752105030488814",
"611752105030488836",
"611752105030488852",
"611752105030488864",
"611752105030488880",
"611752105030488962",
"611752105030488997",
"611752105030489153",
"611752105030489354",
"611752105030489380",
"611752105030489394",
"611752105030489403",
"611752105030489415"
]
ban = deepcopy(banned_user_map)
ban["db"] = "av_db"
for sid in arr:
url = get_url_by_song_id(sid)
if url is not None:
print("out,{},{}".format(url, sid))
sql = "replace INTO svc_queue_table (song_id, url, create_time, update_time) VALUES ({}, \"{}\", NOW(), NOW())" \
.format(sid, url)
update_db(sql, ban)
+def get_data_from_song():
+ sql = """
+ select tb1.song_id, tb1.recording_count
+ from (
+ select song_id,recording_count
+ from starmaker.song
+ where song_src in (108,109) and song_status = 2
+ order by recording_count desc
+ ) as tb1
+ left join
+ (
+ select song_id
+ from av_db.svc_queue_table
+ ) as tb2
+ on tb1.song_id = tb2.song_id
+ where tb2.song_id is null
+ order by tb1.recording_count desc limit 400
+ """
+ ban = deepcopy(banned_user_map)
+ ban_v1 = deepcopy(banned_user_map)
+ ban["db"] = "starmaker_musicbook"
+ ban_v1["db"] = "av_db"
+ data = get_data_by_mysql(sql, ban)
+ for dt in data:
+ sid = dt[0]
+ url = get_url_by_song_id(sid)
+ if url is not None:
+ print("out,{},{}".format(url, sid))
+ sql = "replace INTO svc_queue_table (song_id, url, create_time, update_time) VALUES ({}, \"{}\", NOW(), NOW())" \
+ .format(sid, url)
+ update_db(sql, ban_v1)
+
+
if __name__ == '__main__':
- process()
+ get_data_from_song()

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 12, 08:29 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1347150
Default Alt Text
(10 KB)

Event Timeline