File size: 4,239 Bytes
d773b33
ba9e21b
d773b33
ba9e21b
 
 
d773b33
 
 
 
 
 
 
 
ba9e21b
 
d773b33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba9e21b
d773b33
 
ba9e21b
d773b33
 
 
ba9e21b
d773b33
 
ba9e21b
d773b33
 
ba9e21b
d773b33
 
 
 
ba9e21b
d773b33
 
ba9e21b
 
d773b33
 
 
 
ba9e21b
d773b33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
showModal('<p class="small">Draft loaded successfully βœ…</p>');
      } catch (error) {
        showModal('<p class="small">Error loading draft: ' + error.message + '</p>');
      }
    }

    function resetForm() {
      if (confirm('Are you sure you want to reset the form? All data will be lost.')) {
        document.querySelectorAll('.form-control').forEach(el => {
          if (el.type === 'checkbox') {
            el.checked = false;
          } else {
            el.value = '';
          }
        });

        sunoBlockOut.textContent = 'Suno block will appear here...';
        warningsDisplay.textContent = '';
        document.getElementById('songPrompt').value = '';
        document.getElementById('artPrompt').value = '';
        document.getElementById('videoPrompt').value = '';
        imgGrid.innerHTML = '';
        videoPreview.innerHTML = '';
        videoOut.textContent = 'Video status...';
        removeSongFile();
        clearClips();
        showModal('<p class="small">Form reset successfully βœ…</p>');
      }
    }

    function randomizeForm() {
      const adjectives = ['Happy', 'Romantic', 'Exciting', 'Melancholic', 'Energetic'];
      const genres = ['Pop', 'Rock', 'Jazz', 'Hip Hop', 'Classical'];
      const relationships = ['Mother', 'Father', 'Friend', 'Partner', 'Sibling'];
      const occasions = ['Birthday', 'Anniversary', 'Graduation', 'Wedding', 'Retirement'];

      document.getElementById('songTitle').value = `Song for ${getRandom(occasions)}`;
      document.getElementById('occasion').value = getRandom(occasions);
      document.getElementById('buyerName').value = 'John Doe';
      document.getElementById('recipientName').value = 'Jane Smith';
      document.getElementById('relationship').value = getRandom(relationships);
      document.getElementById('tone').value = getRandom(adjectives);
      document.getElementById('mainGenre').value = getRandom(genres);
      document.getElementById('secondaryGenres').value = getRandom(genres);
      document.getElementById('tempo').value = getRandom(['Fast', 'Medium', 'Slow']);
      document.getElementById('vocalStyle').value = getRandom(['Male', 'Female', 'Duet']);
      document.getElementById('instrumentationNotes').value = 'Piano, guitar, soft drums';
      document.getElementById('keyFacts').value = 'Loves music\nEnjoys traveling\nKind-hearted';
      document.getElementById('stories').value = 'First met in college\nTravel to Paris together';
      document.getElementById('mainMessage').value = 'Thank you for being you';
      document.getElementById('namesPlaces').value = 'Jane\nParis\nCollege';
      document.getElementById('visualStyle').value = 'Cartoon';
      document.getElementById('visualMood').value = 'Bright';
      document.getElementById('visualPlacesThemes').value = 'Beach\nMountains\nCity';
      document.getElementById('visualText').value = 'Happy Birthday!';

      showModal('<p class="small">Form randomized successfully βœ…</p>');
    }

    function getRandom(array) {
      return array[Math.floor(Math.random() * array.length)];
    }

    function runDiagnostics() {
      const diagnostics = [];
      const formData = getFormData();

      // Check API key
      diagnostics.push(`API Key: ${apiKey ? 'βœ… Present' : '❌ Missing'}`);

      // Check required fields
      diagnostics.push(`Buyer Name: ${formData.buyerName ? 'βœ… Present' : '❌ Missing'}`);
      diagnostics.push(`Recipient Name: ${formData.recipientName ? 'βœ… Present' : '❌ Missing'}`);

      // Check song file
      diagnostics.push(`Song File: ${songFile ? 'βœ… Uploaded' : '❌ Not uploaded'}`);

      // Check video clips
      diagnostics.push(`Video Clips: ${videoClips.length > 0 ? 'βœ… Uploaded' : '❌ Not uploaded'}`);

      // Check prompts
      diagnostics.push(`Song Prompt: ${formData.mainMessage ? 'βœ… Present' : '❌ Missing'}`);
      diagnostics.push(`Art Prompt: ${formData.visualStyle ? 'βœ… Present' : '❌ Missing'}`);
      diagnostics.push(`Video Prompt: ${formData.visualMood ? 'βœ… Present' : '❌ Missing'}`);

      diagOut.innerHTML = diagnostics.join('<br>');
      diagOut.style.display = 'block';
    }

    // Initialize the app
    init();
  </script>
</body>

</html>