mirror of
https://github.com/varunsridharan/github-gitea-mirror.git
synced 2024-11-23 09:19:03 +03:00
Update repositoryStared.py
This commit is contained in:
parent
a8730f5bc5
commit
c4ad508c04
@ -26,50 +26,46 @@ def repositoryStared():
|
||||
|
||||
|
||||
|
||||
try:
|
||||
if isBlacklistedRepository(repo.full_name):
|
||||
print(" ---> Warning : Repository Matches Blacklist")
|
||||
continue
|
||||
|
||||
if real_repo in repo_map:
|
||||
gitea_dest_user = repo_map[real_repo]
|
||||
if isBlacklistedRepository(repo.full_name):
|
||||
print(" ---> Warning : Repository Matches Blacklist")
|
||||
continue
|
||||
|
||||
gitea_uid = giteaGetUser(gitea_dest_user)
|
||||
if real_repo in repo_map:
|
||||
gitea_dest_user = repo_map[real_repo]
|
||||
|
||||
if gitea_uid == 'failed':
|
||||
gitea_uid = giteaCreateUserOrOrg(gitea_dest_user,repo.owner.type)
|
||||
gitea_uid = giteaGetUser(gitea_dest_user)
|
||||
|
||||
repo_name = "{0}".format(real_repo)
|
||||
if gitea_uid == 'failed':
|
||||
gitea_uid = giteaCreateUserOrOrg(gitea_dest_user,repo.owner.type)
|
||||
|
||||
m = {
|
||||
"repo_name" : repo_name,
|
||||
"description" : (repo.description or "not really known")[:255],
|
||||
"clone_addr" : repo.clone_url,
|
||||
"mirror" : True,
|
||||
"private" : repo.private,
|
||||
"uid" : gitea_uid,
|
||||
}
|
||||
repo_name = "{0}".format(real_repo)
|
||||
|
||||
status = giteaCreateRepo(m,repo.private,True)
|
||||
if status != 'failed':
|
||||
try:
|
||||
if status != 'exists':
|
||||
giteaExistsRepos['{0}/{1}'.format(repo.owner.login,repo_name)] = "{0}/{1}".format(gitea_dest_user,repo_name)
|
||||
topics = repo.get_topics()
|
||||
topics.append('starred-repo')
|
||||
topics.append('starred-{0}-repo'.format(repo_owner))
|
||||
giteaSetRepoTopics(repo_owner,repo_name,topics)
|
||||
giteaSetRepoStar(repo_owner,repo_name)
|
||||
except GithubException as e:
|
||||
print("###[error] ---> Github API Error Occured !")
|
||||
print(e)
|
||||
print(" ")
|
||||
else:
|
||||
log(repo)
|
||||
except:
|
||||
log("[error] Unknown Error Occured")
|
||||
time.sleep(5)
|
||||
|
||||
m = {
|
||||
"repo_name" : repo_name,
|
||||
"description" : (repo.description or "not really known")[:255],
|
||||
"clone_addr" : repo.clone_url,
|
||||
"mirror" : True,
|
||||
"private" : repo.private,
|
||||
"uid" : gitea_uid,
|
||||
}
|
||||
|
||||
status = giteaCreateRepo(m,repo.private,True)
|
||||
if status != 'failed':
|
||||
try:
|
||||
if status != 'exists':
|
||||
giteaExistsRepos['{0}/{1}'.format(repo.owner.login,repo_name)] = "{0}/{1}".format(gitea_dest_user,repo_name)
|
||||
topics = repo.get_topics()
|
||||
topics.append('starred-repo')
|
||||
topics.append('starred-{0}-repo'.format(repo_owner))
|
||||
giteaSetRepoTopics(repo_owner,repo_name,topics)
|
||||
giteaSetRepoStar(repo_owner,repo_name)
|
||||
except GithubException as e:
|
||||
print("###[error] ---> Github API Error Occured !")
|
||||
print(e)
|
||||
print(" ")
|
||||
else:
|
||||
log(repo)
|
||||
|
||||
if loop_count % 50 == 0:
|
||||
log(False)
|
||||
|
Loading…
Reference in New Issue
Block a user