Merge pull request #85 from neolao/master

Add EXCLUDE parameter for emulator config
This commit is contained in:
GNU 2018-08-05 16:31:12 +08:00 committed by GitHub
commit 0b7f83dc62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import os
import pygame
import glob
import re
import shutil
import gobject
import validators
@ -150,11 +151,18 @@ class RomListPage(Page):
bname = os.path.basename(v) ### filter extension
if len(bname)> 1:
pieces = bname.split(".")
if len(pieces) > 1:
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
dirmap["file"] = v
ret.append(dirmap)
is_excluded = False
for exclude_pattern in self._Emulator["EXCLUDE"]:
if re.match(exclude_pattern, bname):
is_excluded = True
break
if not is_excluded:
pieces = bname.split(".")
if len(pieces) > 1:
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
dirmap["file"] = v
ret.append(dirmap)
# else:
# print("not file or dir")

View File

@ -440,6 +440,7 @@ class MainScreen(object):
obj["ROM"] = ""
obj["ROM_SO"] =""
obj["EXT"] = []
obj["EXCLUDE"] = []
obj["FILETYPE"] = "file"
obj["LAUNCHER"] = ""
obj["TITLE"] = "Game"
@ -459,6 +460,8 @@ class MainScreen(object):
if len(pis) > 1:
if "EXT" in pis[0]:
obj[pis[0]] = pis[1].split(",")
elif "EXCLUDE" in pis[0]
obj[pis[0]] = pis[1].split(",")
else:
obj[pis[0]] = pis[1]