pythonでfoobarのalternativeを作る 12 version 2

2019/05/19 21:15 by yamasyuh68
  :追加された部分   :削除された部分
(差分が大きい場合、文字単位では表示しません)
自分のPCの音楽ファイルをタグでデータベース化 12 # prog
190519 開発日記
## DBからTreeViewを作る


まずDBを綺麗にソートしておく必要
- まずDBを綺麗にソートしておく必要
`artist`と`albumartist`の扱い
でーた取得時のorderを調べる

- order の使い方とか、色々調べるためにまずビューアを少し改造して、いろんなsql文を実行できるようにした
- ソート用の第一キーであるalbumartistだが、noneのときはartistの値となるように少し改造
tupleの変更は出来ないので、いったんリストにして変更してタプルに戻すコードにした
```
            for tag in tags:
                try :
                    tup += m[tag][0],      # add tag-value to tupple
                except:
                    tup += None,
            if tup[3]==None and tup[2]!=None : # albumartist がnoneでartistがある場合
                temp=list(tup)                 # albumartist をartist にする
                temp[3]=tup[2]
                tup=tuple(temp)

            c.execute(com2,tup)

```

      

190519 開発日記

DBからTreeViewを作る

  • まずDBを綺麗にソートしておく必要
    artistalbumartistの扱い
    でーた取得時のorderを調べる

  • order の使い方とか、色々調べるためにまずビューアを少し改造して、いろんなsql文を実行できるようにした

  • ソート用の第一キーであるalbumartistだが、noneのときはartistの値となるように少し改造
    tupleの変更は出来ないので、いったんリストにして変更してタプルに戻すコードにした

            for tag in tags:
                try :
                    tup += m[tag][0],      # add tag-value to tupple
                except:
                    tup += None,
            if tup[3]==None and tup[2]!=None : # albumartist がnoneでartistがある場合
                temp=list(tup)                 # albumartist をartist にする
                temp[3]=tup[2]
                tup=tuple(temp)

            c.execute(com2,tup)