@@ -96,6 +96,7 @@ def cmd_rom_metadata(args):
9696 options ['ROM_EDIT_METADATA_NPLAYERS' ] = "Edit NPlayers: '{}'" .format (rom .get_number_of_players ())
9797 options ['ROM_EDIT_METADATA_NPLAYERS_ONL' ]= "Edit NPlayers online: '{}'" .format (rom .get_number_of_players_online ())
9898 options ['ROM_EDIT_METADATA_ESRB' ] = "Edit ESRB rating: '{}'" .format (rom .get_esrb_rating ())
99+ options ['ROM_EDIT_METADATA_PEGI' ] = "Edit PEGI rating: '{}'" .format (rom .get_pegi_rating ())
99100 options ['ROM_EDIT_METADATA_RATING' ] = "Edit Rating: '{}'" .format (rating )
100101 options ['ROM_EDIT_METADATA_PLOT' ] = "Edit Plot: '{}'" .format (plot_str )
101102 options ['ROM_EDIT_METADATA_TAGS' ] = "Edit Tags"
@@ -215,7 +216,7 @@ def cmd_rom_metadata_title(args):
215216 AppMediator .sync_cmd ('ROM_EDIT_METADATA' , args )
216217
217218@AppMediator .register ('ROM_EDIT_METADATA_ESRB' )
218- def cmd_rom_metadata_platform (args ):
219+ def cmd_rom_metadata_esrb (args ):
219220 rom_id = args ['rom_id' ] if 'rom_id' in args else None
220221 uow = UnitOfWork (globals .g_PATHS .DATABASE_FILE_PATH )
221222 with uow :
@@ -230,6 +231,23 @@ def cmd_rom_metadata_platform(args):
230231 AppMediator .async_cmd ('RENDER_VCATEGORY_VIEW' , {'vcategory_id' : constants .VCATEGORY_ESRB_ID })
231232
232233 AppMediator .sync_cmd ('ROM_EDIT_METADATA' , args )
234+
235+ @AppMediator .register ('ROM_EDIT_METADATA_PEGI' )
236+ def cmd_rom_metadata_pegi (args ):
237+ rom_id = args ['rom_id' ] if 'rom_id' in args else None
238+ uow = UnitOfWork (globals .g_PATHS .DATABASE_FILE_PATH )
239+ with uow :
240+ repository = ROMsRepository (uow )
241+ rom = repository .find_rom (rom_id )
242+
243+ if editors .edit_field_by_list (rom , 'PEGI rating' , constants .PEGI_LIST ,
244+ rom .get_pegi_rating , rom .set_pegi_rating ):
245+ repository .update_rom (rom )
246+ uow .commit ()
247+ AppMediator .async_cmd ('RENDER_ROM_VIEWS' , {'rom_id' : rom .get_id ()})
248+ AppMediator .async_cmd ('RENDER_VCATEGORY_VIEW' , {'vcategory_id' : constants .VCATEGORY_PEGI_ID })
249+
250+ AppMediator .sync_cmd ('ROM_EDIT_METADATA' , args )
233251
234252@AppMediator .register ('ROM_EDIT_METADATA_RELEASEYEAR' )
235253def cmd_rom_metadata_releaseyear (args ):
0 commit comments