Skip to content

Commit

Permalink
色名を取得する
Browse files Browse the repository at this point in the history
  • Loading branch information
pinfort committed Jan 9, 2019
1 parent 8bcf4fa commit 698cfa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions colors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def colors(nf):
if nf == 1:
return ["Y"]
elif nf == 2:
return ["Y", "A"]
elif nf == 3:
return ["Y", "Cb", "Cr"]
elif nf == 4:
return ["Y", "Cb", "Cr", "A"]
else:
raise ValueError("invalid value")
3 changes: 3 additions & 0 deletions segments/SOFs/SOF2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from segments.segmentsCommon import SegmentsCommon
from markers import Markers
from colors import colors

class SOF2(SegmentsCommon):
def __init__(self):
Expand All @@ -20,6 +21,8 @@ def analyze(self, marker, body):
nfLength = 3
for i in range(analyzed["nf"]):
nfDict = {}
nfDict["id"] = i + 1
nfDict["name"] = colors(analyzed["nf"])[i]
nf = body[nfHead:nfHead + nfLength]
nfDict["cn"] = nf[0]
hv = nf[1]
Expand Down

0 comments on commit 698cfa4

Please sign in to comment.