Browse Source

Preparando comando para insertar

politica
Celestino Rey 1 year ago
parent
commit
52e3eeb359
5 changed files with 43 additions and 44 deletions
  1. +1
    -2
      ReyMotaAppsDj/.dockerignore
  2. +1
    -1
      ReyMotaAppsDj/K8S/Makefile.local
  3. +13
    -13
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_album.py
  4. +13
    -13
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_artista.py
  5. +15
    -15
      ReyMotaAppsDj/reymota/lyrics/management/commands/importa_song.py

+ 1
- 2
ReyMotaAppsDj/.dockerignore View File

@ -1,5 +1,4 @@
Dockerfile
Makefile
volcadossql/
venv/
reymota/lyrics/management/
venv/

+ 1
- 1
ReyMotaAppsDj/K8S/Makefile.local View File

@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':')
export REGISTRY=localhost:30500
#export REGISTRY=registry.reymota.es
export IMG_VERSION = 0.43
export IMG_VERSION = 0.44
export IMG_NGINX_VERSION = 1.0
# limpia todo


+ 13
- 13
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_album.py View File

@ -6,18 +6,18 @@ from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)

+ 13
- 13
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_artista.py View File

@ -6,18 +6,18 @@ from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
name = row['name'],
artist = row['artist'],
year = row['year'],
cover_image = row['cover_image']
print(name, ",", artist, ",", year, ",", cover_image)

+ 15
- 15
ReyMotaAppsDj/reymota/lyrics/management/commands/importa_song.py View File

@ -6,20 +6,20 @@ from datetime import datetime
class Command(BaseCommand):
help = "Importa la lista de letras"
help = "Importa la lista de letras"
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def add_arguments(self, parser):
parser.add_argument("fichero_csv", type=str, help='Ruta al fichero csv')
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
title = row['title'],
artist = row['artist'],
album = row['album'],
year = row['year'],
lyrics = row['lyrics']
pista = row['pista']
print(title, ",", artist, ",", album, ",", year, ",", pista)
def handle(self, *args, **options):
fichero = options["fichero_csv"]
with open(fichero, 'r') as file:
reader = csv.DictReader(file)
for row in reader:
title = row['title'],
artist = row['artist'],
album = row['album'],
year = row['year'],
lyrics = row['lyrics']
pista = row['pista']
print(title, ",", artist, ",", album, ",", year, ",", pista)

Loading…
Cancel
Save