Skip to content

Commit

Permalink
Merge pull request #170 from codingpot/feat/169/add-pr-332-339
Browse files Browse the repository at this point in the history
feat: add PR videos
  • Loading branch information
deep-diver authored Aug 17, 2021
2 parents 633a707 + abcbc63 commit a358f58
Show file tree
Hide file tree
Showing 5 changed files with 10,059 additions and 8,642 deletions.
3 changes: 1 addition & 2 deletions client/lib/sort_preference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class SortMode extends ChangeNotifier {
}

// This type should not be a widget(e.g. Icon) because of mockito support...
IconData get icon =>
_isDescOrder ? Icons.arrow_upward : Icons.arrow_downward;
IconData get icon => _isDescOrder ? Icons.arrow_upward : Icons.arrow_downward;

// This type should not be a widget(e.g. Text) because of mockito support...
String get text => _isDescOrder ? "오름차순으로" : "내림차순으로";
Expand Down
71 changes: 25 additions & 46 deletions dbctl/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
# Metadata manager

## 1. Generate a metadata from the mapping table

MappingTable(database.proto)

```proto
message MappingTable {
repeated MappingTableRow rows = 1;
}
message MappingTableRow {
int32 pr_id = 1;
repeated string paper_arxiv_id = 2;
string youtube_video_id = 3;
}
```

Database(database.proto)

```proto
message Database {
map<int32, PrVideo> pr_id_to_video = 1;
}
// PR영상의 하나의 레코드
message PrVideo {
int32 pr_id = 1;
// 관련도에 따라 정렬
repeated Paper papers = 2;
YouTubeVideo video = 3;
}
// 유튜브 1편에 대한 정보
// `pkg.pr12er.Video` 생성하기 위해 사용됩니다.
message YouTubeVideo {
string video_id = 1;
string video_title = 2;
int64 number_of_likes = 3;
int64 number_of_views = 4;
google.protobuf.Timestamp published_date = 5;
string uploader = 6;
}
```

2.
# dbctl

`dbctl` 은 데이터베이스 파일을 업데이트 하는데 사용됩니다.

## 새로운 PR 영상을 추가하기

1. PR 영상의 유튜브 주소를 획득합니다.
2. 아래 스크립트를 실행합니다 (bash 기준).

```bash
youtube_links=(
https://youtu.be/-5fFL68d7Gg
https://youtu.be/I9kQwMbpxuE
https://youtu.be/HWf8CmTAIR4
https://youtu.be/FFXAm2uTmeI
https://youtu.be/20kxrS2yglg
https://youtu.be/BZwUR9hvBPE
https://youtu.be/hptinxZIXT4
)

for youtube in ${youtube_links[@]}
do
go run main.go youtube --youtube-link $youtube >> ../server/internal/data/mapping_table.pbtxt
done
```
8 changes: 8 additions & 0 deletions dbctl/internal/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ func ExtractPaperIDs(title string) ([]string, error) {
}

var paperIDs []string
// save paperIDs that were already seen.
seenPaperID := map[string]bool{}

for i := 0; i < maxLen; i++ {
arxivID, _ := ExtractArxivIDFromURL(search[i].URL)

if seenPaperID[arxivID] {
continue
}

paperIDs = append(paperIDs, arxivID)
seenPaperID[arxivID] = true
}

return paperIDs, nil
Expand Down
Loading

0 comments on commit a358f58

Please sign in to comment.