Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eff1ba2

Browse files
make app order later
1 parent 883ff4e commit eff1ba2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎web/utils/format_order.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/local/bin/python3
2+
# coding: utf-8
3+
4+
# YYeTsBot - format_order.py
5+
# 2/9/21 16:24
6+
#
7+
8+
__author__ = "Benny <benny.think@gmail.com>"
9+
10+
import pymongo
11+
12+
client = pymongo.MongoClient(host="mongo")
13+
db = client["zimuzu"]
14+
col = db["yyets"]
15+
16+
all_data = col.find().sort("data.info.id")
17+
18+
for resource in all_data:
19+
for index in range(len(resource["data"]["list"])):
20+
season = resource["data"]["list"][index]
21+
if season["formats"][0] == "APP":
22+
order = season["formats"][1:]
23+
order.append("APP")
24+
rid = resource["data"]["info"]["id"]
25+
set_value = {"$set": {f"data.list.{index}.formats": order}}
26+
print(f"{rid}-{index}->{set_value}")
27+
col.find_one_and_update({"data.info.id": rid}, set_value)
28+
client.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /